diff options
-rw-r--r-- | gob/cdrom.cpp | 2 | ||||
-rw-r--r-- | gob/dataio.cpp | 112 | ||||
-rw-r--r-- | gob/draw.cpp | 68 | ||||
-rw-r--r-- | gob/draw.h | 164 | ||||
-rw-r--r-- | gob/game.cpp | 234 | ||||
-rw-r--r-- | gob/global.cpp | 196 | ||||
-rw-r--r-- | gob/global.h | 130 | ||||
-rw-r--r-- | gob/gob.cpp | 21 | ||||
-rw-r--r-- | gob/gob.h | 2 | ||||
-rw-r--r-- | gob/goblin.cpp | 34 | ||||
-rw-r--r-- | gob/init.cpp | 130 | ||||
-rw-r--r-- | gob/init.h | 4 | ||||
-rw-r--r-- | gob/inter.cpp | 262 | ||||
-rw-r--r-- | gob/mult.cpp | 102 | ||||
-rw-r--r-- | gob/palanim.cpp | 86 | ||||
-rw-r--r-- | gob/parse.cpp | 264 | ||||
-rw-r--r-- | gob/scenery.cpp | 12 | ||||
-rw-r--r-- | gob/sound.cpp | 35 | ||||
-rw-r--r-- | gob/sound.h | 11 | ||||
-rw-r--r-- | gob/util.cpp | 30 | ||||
-rw-r--r-- | gob/video.cpp | 68 |
21 files changed, 982 insertions, 985 deletions
diff --git a/gob/cdrom.cpp b/gob/cdrom.cpp index ed05812c87..5e34a9fed0 100644 --- a/gob/cdrom.cpp +++ b/gob/cdrom.cpp @@ -143,7 +143,7 @@ void CDROM::playMultMusic() { for (int i = 0; i < ARRAYSIZE(tracks); i++) if (!scumm_stricmp(_vm->_game->curTotFile, tracks[i][0])) { _cdPlaying = true; - startTrack(tracks[i][_vm->_global->language + 1]); + startTrack(tracks[i][_vm->_global->_language + 1]); break; } } diff --git a/gob/dataio.cpp b/gob/dataio.cpp index e0743566d4..d2ecfd9de5 100644 --- a/gob/dataio.cpp +++ b/gob/dataio.cpp @@ -30,7 +30,7 @@ DataIO::DataIO(GobEngine *vm) : _vm(vm) { } Common::File *DataIO::file_getHandle(int16 handle) { - return &_vm->_global->filesHandles[handle]; + return &_vm->_global->_filesHandles[handle]; } int16 DataIO::file_open(const char *path, Common::File::AccessMode mode) { @@ -58,28 +58,28 @@ int16 DataIO::getChunk(const char *chunkName) { struct ChunkDesc *dataDesc; for (file = 0; file < MAX_DATA_FILES; file++) { - if (_vm->_global->dataFiles[file] == 0) + if (_vm->_global->_dataFiles[file] == 0) return -1; for (slot = 0; slot < MAX_SLOT_COUNT; slot++) - if (_vm->_global->chunkPos[file * MAX_SLOT_COUNT + slot] == -1) + if (_vm->_global->_chunkPos[file * MAX_SLOT_COUNT + slot] == -1) break; if (slot == MAX_SLOT_COUNT) return -1; - dataDesc = _vm->_global->dataFiles[file]; - for (chunk = 0; chunk < _vm->_global->numDataChunks[file]; + dataDesc = _vm->_global->_dataFiles[file]; + for (chunk = 0; chunk < _vm->_global->_numDataChunks[file]; chunk++, dataDesc++) { if (scumm_stricmp(chunkName, dataDesc->chunkName) != 0) continue; - _vm->_global->isCurrentSlot[file * MAX_SLOT_COUNT + slot] = 0; - _vm->_global->chunkSize[file * MAX_SLOT_COUNT + slot] = + _vm->_global->_isCurrentSlot[file * MAX_SLOT_COUNT + slot] = 0; + _vm->_global->_chunkSize[file * MAX_SLOT_COUNT + slot] = dataDesc->size; - _vm->_global->chunkOffset[file * MAX_SLOT_COUNT + slot] = + _vm->_global->_chunkOffset[file * MAX_SLOT_COUNT + slot] = dataDesc->offset; - _vm->_global->chunkPos[file * MAX_SLOT_COUNT + slot] = 0; + _vm->_global->_chunkPos[file * MAX_SLOT_COUNT + slot] = 0; return file * 10 + slot + 50; } } @@ -89,7 +89,7 @@ int16 DataIO::getChunk(const char *chunkName) { char DataIO::freeChunk(int16 handle) { if (handle >= 50 && handle < 100) { handle -= 50; - _vm->_global->chunkPos[(handle / 10) * MAX_SLOT_COUNT + (handle % 10)] = -1; + _vm->_global->_chunkPos[(handle / 10) * MAX_SLOT_COUNT + (handle % 10)] = -1; return 0; } return 1; @@ -106,26 +106,26 @@ int32 DataIO::readChunk(int16 handle, char *buf, int16 size) { file = (handle - 50) / 10; slot = (handle - 50) % 10; - if (_vm->_global->isCurrentSlot[file * MAX_SLOT_COUNT + slot] == 0) { + if (_vm->_global->_isCurrentSlot[file * MAX_SLOT_COUNT + slot] == 0) { for (i = 0; i < MAX_SLOT_COUNT; i++) - _vm->_global->isCurrentSlot[file * MAX_SLOT_COUNT + i] = 0; + _vm->_global->_isCurrentSlot[file * MAX_SLOT_COUNT + i] = 0; offset = - _vm->_global->chunkOffset[file * MAX_SLOT_COUNT + slot] + - _vm->_global->chunkPos[file * MAX_SLOT_COUNT + slot]; - debug(7, "seek: %ld, %ld", _vm->_global->chunkOffset[file * MAX_SLOT_COUNT + slot], _vm->_global->chunkPos[file * MAX_SLOT_COUNT + slot]); - file_getHandle(_vm->_global->dataFileHandles[file])->seek(offset, SEEK_SET); + _vm->_global->_chunkOffset[file * MAX_SLOT_COUNT + slot] + + _vm->_global->_chunkPos[file * MAX_SLOT_COUNT + slot]; + debug(7, "seek: %ld, %ld", _vm->_global->_chunkOffset[file * MAX_SLOT_COUNT + slot], _vm->_global->_chunkPos[file * MAX_SLOT_COUNT + slot]); + file_getHandle(_vm->_global->_dataFileHandles[file])->seek(offset, SEEK_SET); } - _vm->_global->isCurrentSlot[file * MAX_SLOT_COUNT + slot] = 1; - if (_vm->_global->chunkPos[file * MAX_SLOT_COUNT + slot] + size > - _vm->_global->chunkSize[file * MAX_SLOT_COUNT + slot]) + _vm->_global->_isCurrentSlot[file * MAX_SLOT_COUNT + slot] = 1; + if (_vm->_global->_chunkPos[file * MAX_SLOT_COUNT + slot] + size > + _vm->_global->_chunkSize[file * MAX_SLOT_COUNT + slot]) size = - _vm->_global->chunkSize[file * MAX_SLOT_COUNT + slot] - - _vm->_global->chunkPos[file * MAX_SLOT_COUNT + slot]; + _vm->_global->_chunkSize[file * MAX_SLOT_COUNT + slot] - + _vm->_global->_chunkPos[file * MAX_SLOT_COUNT + slot]; - file_getHandle(_vm->_global->dataFileHandles[file])->read(buf, size); - _vm->_global->chunkPos[file * MAX_SLOT_COUNT + slot] += size; + file_getHandle(_vm->_global->_dataFileHandles[file])->read(buf, size); + _vm->_global->_chunkPos[file * MAX_SLOT_COUNT + slot] += size; return size; } @@ -138,13 +138,13 @@ int16 DataIO::seekChunk(int16 handle, int32 pos, int16 from) { file = (handle - 50) / 10; slot = (handle - 50) % 10; - _vm->_global->isCurrentSlot[file * MAX_SLOT_COUNT + slot] = 0; + _vm->_global->_isCurrentSlot[file * MAX_SLOT_COUNT + slot] = 0; if (from == SEEK_SET) - _vm->_global->chunkPos[file * MAX_SLOT_COUNT + slot] = pos; + _vm->_global->_chunkPos[file * MAX_SLOT_COUNT + slot] = pos; else - _vm->_global->chunkPos[file * MAX_SLOT_COUNT + slot] += pos; + _vm->_global->_chunkPos[file * MAX_SLOT_COUNT + slot] += pos; - return _vm->_global->chunkPos[file * MAX_SLOT_COUNT + slot]; + return _vm->_global->_chunkPos[file * MAX_SLOT_COUNT + slot]; } int32 DataIO::getChunkSize(const char *chunkName) { @@ -155,26 +155,26 @@ int32 DataIO::getChunkSize(const char *chunkName) { int32 realSize; for (file = 0; file < MAX_DATA_FILES; file++) { - if (_vm->_global->dataFiles[file] == 0) + if (_vm->_global->_dataFiles[file] == 0) return -1; - dataDesc = _vm->_global->dataFiles[file]; - for (chunk = 0; chunk < _vm->_global->numDataChunks[file]; + dataDesc = _vm->_global->_dataFiles[file]; + for (chunk = 0; chunk < _vm->_global->_numDataChunks[file]; chunk++, dataDesc++) { if (scumm_stricmp(chunkName, dataDesc->chunkName) != 0) continue; if (dataDesc->packed == 0) { - _vm->_global->packedSize = -1; + _vm->_global->_packedSize = -1; return dataDesc->size; } for (slot = 0; slot < MAX_SLOT_COUNT; slot++) - _vm->_global->isCurrentSlot[slot] = 0; + _vm->_global->_isCurrentSlot[slot] = 0; - file_getHandle(_vm->_global->dataFileHandles[file])->seek(dataDesc->offset, SEEK_SET); - realSize = file_getHandle(_vm->_global->dataFileHandles[file])->readUint32LE(); - _vm->_global->packedSize = dataDesc->size; + file_getHandle(_vm->_global->_dataFileHandles[file])->seek(dataDesc->offset, SEEK_SET); + realSize = file_getHandle(_vm->_global->_dataFileHandles[file])->readUint32LE(); + _vm->_global->_packedSize = dataDesc->size; return realSize; } } @@ -193,46 +193,46 @@ void DataIO::openDataFile(const char *src) { strcat(path, ".stk"); for (file = 0; file < MAX_DATA_FILES; file++) - if (_vm->_global->dataFiles[file] == 0) + if (_vm->_global->_dataFiles[file] == 0) break; if (file == MAX_DATA_FILES) error("dataFileOpen: Data file slots are full\n"); - _vm->_global->dataFileHandles[file] = file_open(path); + _vm->_global->_dataFileHandles[file] = file_open(path); - if (_vm->_global->dataFileHandles[file] == -1) + if (_vm->_global->_dataFileHandles[file] == -1) error("dataFileOpen: Can't open %s data file\n", path); - _vm->_global->numDataChunks[file] = file_getHandle(_vm->_global->dataFileHandles[file])->readUint16LE(); + _vm->_global->_numDataChunks[file] = file_getHandle(_vm->_global->_dataFileHandles[file])->readUint16LE(); - debug(7, "DataChunks: %d [for %s]", _vm->_global->numDataChunks[file], path); + debug(7, "DataChunks: %d [for %s]", _vm->_global->_numDataChunks[file], path); - _vm->_global->dataFiles[file] = dataDesc = + _vm->_global->_dataFiles[file] = dataDesc = (struct ChunkDesc *)malloc(sizeof(struct ChunkDesc) * - _vm->_global->numDataChunks[file]); + _vm->_global->_numDataChunks[file]); - for (i = 0; i < _vm->_global->numDataChunks[file]; i++) { - file_getHandle(_vm->_global->dataFileHandles[file])->read(dataDesc[i].chunkName, 13); - dataDesc[i].size = file_getHandle(_vm->_global->dataFileHandles[file])->readUint32LE(); - dataDesc[i].offset = file_getHandle(_vm->_global->dataFileHandles[file])->readUint32LE(); - dataDesc[i].packed = file_getHandle(_vm->_global->dataFileHandles[file])->readByte(); + for (i = 0; i < _vm->_global->_numDataChunks[file]; i++) { + file_getHandle(_vm->_global->_dataFileHandles[file])->read(dataDesc[i].chunkName, 13); + dataDesc[i].size = file_getHandle(_vm->_global->_dataFileHandles[file])->readUint32LE(); + dataDesc[i].offset = file_getHandle(_vm->_global->_dataFileHandles[file])->readUint32LE(); + dataDesc[i].packed = file_getHandle(_vm->_global->_dataFileHandles[file])->readByte(); } - for (i = 0; i < _vm->_global->numDataChunks[file]; i++) + for (i = 0; i < _vm->_global->_numDataChunks[file]; i++) debug(7, "%d: %s %d", i, dataDesc[i].chunkName, dataDesc[i].size); for (i = 0; i < MAX_SLOT_COUNT; i++) - _vm->_global->chunkPos[file * MAX_SLOT_COUNT + i] = -1; + _vm->_global->_chunkPos[file * MAX_SLOT_COUNT + i] = -1; } void DataIO::closeDataFile() { int16 file; for (file = MAX_DATA_FILES - 1; file >= 0; file--) { - if (_vm->_global->dataFiles[file] != 0) { - free(_vm->_global->dataFiles[file]); - _vm->_global->dataFiles[file] = 0; - file_getHandle(_vm->_global->dataFileHandles[file])->close(); + if (_vm->_global->_dataFiles[file] != 0) { + free(_vm->_global->_dataFiles[file]); + _vm->_global->_dataFiles[file] = 0; + file_getHandle(_vm->_global->_dataFileHandles[file])->close(); return; } } @@ -247,7 +247,7 @@ char *DataIO::getUnpackedData(const char *name) { int32 sizeLeft; realSize = getChunkSize(name); - if (_vm->_global->packedSize == -1 || realSize == -1) + if (_vm->_global->_packedSize == -1 || realSize == -1) return 0; chunk = getChunk(name); @@ -258,13 +258,13 @@ char *DataIO::getUnpackedData(const char *name) { if (unpackBuf == 0) return 0; - packBuf = (char *)malloc(_vm->_global->packedSize); + packBuf = (char *)malloc(_vm->_global->_packedSize); if (packBuf == 0) { free(unpackBuf); return 0; } - sizeLeft = _vm->_global->packedSize; + sizeLeft = _vm->_global->_packedSize; ptr = packBuf; while (sizeLeft > 0x4000) { readChunk(chunk, ptr, 0x4000); diff --git a/gob/draw.cpp b/gob/draw.cpp index 17273da482..7ece03efc3 100644 --- a/gob/draw.cpp +++ b/gob/draw.cpp @@ -257,14 +257,14 @@ void Draw::blitInvalidated(void) { return; } - _vm->_global->doRangeClamp = 0; + _vm->_global->_doRangeClamp = 0; for (i = 0; i < invalidatedCount; i++) { _vm->_video->drawSprite(backSurface, frontSurface, invalidatedLefts[i], invalidatedTops[i], invalidatedRights[i], invalidatedBottoms[i], invalidatedLefts[i], invalidatedTops[i], 0); } - _vm->_global->doRangeClamp = 1; + _vm->_global->_doRangeClamp = 1; invalidatedCount = 0; noInvalidated = 1; @@ -272,14 +272,14 @@ void Draw::blitInvalidated(void) { } void Draw::setPalette(void) { - if (_vm->_global->videoMode != 0x13) + if (_vm->_global->_videoMode != 0x13) error("setPalette: Video mode 0x%x is not supported!\n", - _vm->_global->videoMode); + _vm->_global->_videoMode); - _vm->_global->pPaletteDesc->unused1 = unusedPalette1; - _vm->_global->pPaletteDesc->unused2 = unusedPalette2; - _vm->_global->pPaletteDesc->vgaPal = vgaPalette; - _vm->_video->setFullPalette(_vm->_global->pPaletteDesc); + _vm->_global->_pPaletteDesc->unused1 = unusedPalette1; + _vm->_global->_pPaletteDesc->unused2 = unusedPalette2; + _vm->_global->_pPaletteDesc->vgaPal = vgaPalette; + _vm->_video->setFullPalette(_vm->_global->_pPaletteDesc); paletteCleared = 0; } @@ -603,16 +603,16 @@ void Draw::animateCursor(int16 cursor) { if (ptr->flags & 0xfff0) continue; - if (ptr->left > _vm->_global->inter_mouseX) + if (ptr->left > _vm->_global->_inter_mouseX) continue; - if (ptr->right < _vm->_global->inter_mouseX) + if (ptr->right < _vm->_global->_inter_mouseX) continue; - if (ptr->top > _vm->_global->inter_mouseY) + if (ptr->top > _vm->_global->_inter_mouseY) continue; - if (ptr->bottom < _vm->_global->inter_mouseY) + if (ptr->bottom < _vm->_global->_inter_mouseY) continue; if ((ptr->flags & 0xf) < 3) @@ -655,8 +655,8 @@ void Draw::animateCursor(int16 cursor) { cursorAnim = cursorAnimLow[gcursorIndex]; } - newX = _vm->_global->inter_mouseX; - newY = _vm->_global->inter_mouseY; + newX = _vm->_global->_inter_mouseX; + newY = _vm->_global->_inter_mouseY; if (cursorXDeltaVar != -1) { newX -= (uint16)VAR_OFFSET(gcursorIndex * 4 + (cursorXDeltaVar / 4) * 4); newY -= (uint16)VAR_OFFSET(gcursorIndex * 4 + (cursorYDeltaVar / 4) * 4); @@ -681,7 +681,7 @@ void Draw::animateCursor(int16 cursor) { blitInvalidated(); gcursorIndex = cursorIndex; } else { - _vm->_video->waitRetrace(_vm->_global->videoMode); + _vm->_video->waitRetrace(_vm->_global->_videoMode); } _vm->_video->drawSprite(backSurface, frontSurface, @@ -705,7 +705,7 @@ void Draw::interPalLoad(void) { byte cmd; char *palPtr; - cmd = *_vm->_global->inter_execPtr++; + cmd = *_vm->_global->_inter_execPtr++; applyPal = 0; if (cmd & 0x80) cmd &= 0x7f; @@ -715,40 +715,40 @@ void Draw::interPalLoad(void) { if (cmd == 49) { warning("inter_palLoad: cmd == 49 is not supported"); //var_B = 1; - for (i = 0; i < 18; i++, _vm->_global->inter_execPtr++) { + for (i = 0; i < 18; i++, _vm->_global->_inter_execPtr++) { if (i < 2) { if (applyPal == 0) continue; - unusedPalette1[i] = *_vm->_global->inter_execPtr; + unusedPalette1[i] = *_vm->_global->_inter_execPtr; continue; } //if (*inter_execPtr != 0) // var_B = 0; - ind1 = *_vm->_global->inter_execPtr >> 4; - ind2 = (*_vm->_global->inter_execPtr & 0xf); + ind1 = *_vm->_global->_inter_execPtr >> 4; + ind2 = (*_vm->_global->_inter_execPtr & 0xf); unusedPalette1[i] = ((palLoadData1[ind1] + palLoadData2[ind2]) << 8) + (palLoadData2[ind1] + palLoadData1[ind2]); } - _vm->_global->pPaletteDesc->unused1 = unusedPalette1; + _vm->_global->_pPaletteDesc->unused1 = unusedPalette1; } switch (cmd) { case 52: - for (i = 0; i < 16; i++, _vm->_global->inter_execPtr += 3) { - vgaSmallPalette[i].red = _vm->_global->inter_execPtr[0]; - vgaSmallPalette[i].green = _vm->_global->inter_execPtr[1]; - vgaSmallPalette[i].blue = _vm->_global->inter_execPtr[2]; + for (i = 0; i < 16; i++, _vm->_global->_inter_execPtr += 3) { + vgaSmallPalette[i].red = _vm->_global->_inter_execPtr[0]; + vgaSmallPalette[i].green = _vm->_global->_inter_execPtr[1]; + vgaSmallPalette[i].blue = _vm->_global->_inter_execPtr[2]; } break; case 50: - for (i = 0; i < 16; i++, _vm->_global->inter_execPtr++) - unusedPalette2[i] = *_vm->_global->inter_execPtr; + for (i = 0; i < 16; i++, _vm->_global->_inter_execPtr++) + unusedPalette2[i] = *_vm->_global->_inter_execPtr; break; case 53: @@ -761,15 +761,15 @@ void Draw::interPalLoad(void) { break; } if (!applyPal) { - _vm->_global->pPaletteDesc->unused2 = unusedPalette2; - _vm->_global->pPaletteDesc->unused1 = unusedPalette1; + _vm->_global->_pPaletteDesc->unused2 = unusedPalette2; + _vm->_global->_pPaletteDesc->unused1 = unusedPalette1; - if (_vm->_global->videoMode != 0x13) - _vm->_global->pPaletteDesc->vgaPal = (Video::Color *)vgaSmallPalette; + if (_vm->_global->_videoMode != 0x13) + _vm->_global->_pPaletteDesc->vgaPal = (Video::Color *)vgaSmallPalette; else - _vm->_global->pPaletteDesc->vgaPal = (Video::Color *)vgaPalette; + _vm->_global->_pPaletteDesc->vgaPal = (Video::Color *)vgaPalette; - _vm->_palanim->fade((Video::PalDesc *) _vm->_global->pPaletteDesc, 0, 0); + _vm->_palanim->fade((Video::PalDesc *) _vm->_global->_pPaletteDesc, 0, 0); } } @@ -883,7 +883,7 @@ void Draw::printText(void) { } else if (cmd == 1) { val = READ_LE_UINT16(ptr2 + 18) * 4; - strcpy(buf, _vm->_global->inter_variables + val); + strcpy(buf, _vm->_global->_inter_variables + val); } else { val = READ_LE_UINT16(ptr2 + 18) * 4; diff --git a/gob/draw.h b/gob/draw.h index 2084aa1bf5..ac0c68542f 100644 --- a/gob/draw.h +++ b/gob/draw.h @@ -32,92 +32,92 @@ namespace Gob { #define RENDERFLAG_USEDELTAS 0x10 class Draw { - public: - typedef struct FontToSprite { - int8 sprite; - int8 base; - int8 width; - int8 height; - FontToSprite() : sprite(0), base(0), width(0), height() {} - } FontToSprite; - - int16 fontIndex; - int16 spriteLeft; - int16 spriteTop; - int16 spriteRight; - int16 spriteBottom; - int16 destSpriteX; - int16 destSpriteY; - int16 backColor; - int16 frontColor; - char letterToPrint; - FontToSprite fontToSprite[4]; - int16 destSurface; - int16 sourceSurface; - int16 renderFlags; - int16 backDeltaX; - int16 backDeltaY; - Video::FontDesc *fonts[4]; - char *textToPrint; - int16 transparency; - Video::SurfaceDesc *spritesArray[50]; - - int16 invalidatedCount; - int16 invalidatedTops[30]; - int16 invalidatedLefts[30]; - int16 invalidatedRights[30]; - int16 invalidatedBottoms[30]; - - int8 noInvalidated; -// int8 doFullFlip; // Never used?!? - int8 paletteCleared; - - int16 gcursorIndex; - int16 transparentCursor; - uint32 cursorTimeKey; - - Video::SurfaceDesc *backSurface; - Video::SurfaceDesc *frontSurface; - - int16 unusedPalette1[18]; - int16 unusedPalette2[16]; - Video::Color vgaPalette[256]; - Video::Color vgaSmallPalette[16]; - - int16 cursorX; - int16 cursorY; - int16 cursorWidth; - int16 cursorHeight; - - int16 cursorXDeltaVar; - int16 cursorYDeltaVar; - - Video::SurfaceDesc *cursorSprites; - Video::SurfaceDesc *cursorBack; - int16 cursorAnim; - int8 cursorAnimLow[40]; - int8 cursorAnimHigh[40]; - int8 cursorAnimDelays[40]; - int8 applyPal; - - int16 palLoadData1[4]; - int16 palLoadData2[4]; +public: + typedef struct FontToSprite { + int8 sprite; + int8 base; + int8 width; + int8 height; + FontToSprite() : sprite(0), base(0), width(0), height() {} + } FontToSprite; + + int16 fontIndex; + int16 spriteLeft; + int16 spriteTop; + int16 spriteRight; + int16 spriteBottom; + int16 destSpriteX; + int16 destSpriteY; + int16 backColor; + int16 frontColor; + char letterToPrint; + FontToSprite fontToSprite[4]; + int16 destSurface; + int16 sourceSurface; + int16 renderFlags; + int16 backDeltaX; + int16 backDeltaY; + Video::FontDesc *fonts[4]; + char *textToPrint; + int16 transparency; + Video::SurfaceDesc *spritesArray[50]; + + int16 invalidatedCount; + int16 invalidatedTops[30]; + int16 invalidatedLefts[30]; + int16 invalidatedRights[30]; + int16 invalidatedBottoms[30]; + + int8 noInvalidated; +// int8 doFullFlip; // Never used?!? + int8 paletteCleared; + + int16 gcursorIndex; + int16 transparentCursor; + uint32 cursorTimeKey; + + Video::SurfaceDesc *backSurface; + Video::SurfaceDesc *frontSurface; + + int16 unusedPalette1[18]; + int16 unusedPalette2[16]; + Video::Color vgaPalette[256]; + Video::Color vgaSmallPalette[16]; + + int16 cursorX; + int16 cursorY; + int16 cursorWidth; + int16 cursorHeight; + + int16 cursorXDeltaVar; + int16 cursorYDeltaVar; + + Video::SurfaceDesc *cursorSprites; + Video::SurfaceDesc *cursorBack; + int16 cursorAnim; + int8 cursorAnimLow[40]; + int8 cursorAnimHigh[40]; + int8 cursorAnimDelays[40]; + int8 applyPal; + + int16 palLoadData1[4]; + int16 palLoadData2[4]; - void invalidateRect(int16 left, int16 top, int16 right, int16 bottom); - void blitInvalidated(void); - void setPalette(void); - void clearPalette(void); - void blitCursor(void); + void invalidateRect(int16 left, int16 top, int16 right, int16 bottom); + void blitInvalidated(void); + void setPalette(void); + void clearPalette(void); + void blitCursor(void); - void spriteOperation(int16 operation); - void animateCursor(int16 cursor); - void interPalLoad(void); - void printText(void); + void spriteOperation(int16 operation); + void animateCursor(int16 cursor); + void interPalLoad(void); + void printText(void); - Draw(GobEngine *vm); + Draw(GobEngine *vm); - protected: - GobEngine *_vm; +protected: + GobEngine *_vm; }; // Draw operations diff --git a/gob/game.cpp b/gob/game.cpp index e3bf942ff1..b1d2c5d5d4 100644 --- a/gob/game.cpp +++ b/gob/game.cpp @@ -277,10 +277,10 @@ int16 Game::checkMousePoint(int16 all, int16 *resId, int16 *resIndex) { if ((ptr->flags & 0xff00) != 0) continue; - if (_vm->_global->inter_mouseX < ptr->left - || _vm->_global->inter_mouseX > ptr->right - || _vm->_global->inter_mouseY < ptr->top - || _vm->_global->inter_mouseY > ptr->bottom) + if (_vm->_global->_inter_mouseX < ptr->left + || _vm->_global->_inter_mouseX > ptr->right + || _vm->_global->_inter_mouseY < ptr->top + || _vm->_global->_inter_mouseY > ptr->bottom) continue; if (resId != 0) @@ -299,10 +299,10 @@ int16 Game::checkMousePoint(int16 all, int16 *resId, int16 *resIndex) { && (ptr->flags & 0xf0) >> 4 != 2) continue; - if (_vm->_global->inter_mouseX < ptr->left - || _vm->_global->inter_mouseX > ptr->right - || _vm->_global->inter_mouseY < ptr->top - || _vm->_global->inter_mouseY > ptr->bottom) + if (_vm->_global->_inter_mouseX < ptr->left + || _vm->_global->_inter_mouseX > ptr->right + || _vm->_global->_inter_mouseY < ptr->top + || _vm->_global->_inter_mouseY > ptr->bottom) continue; if (resId != 0) @@ -337,7 +337,7 @@ void Game::capturePush(int16 left, int16 top, int16 width, int16 height) { right |= 0xf; _vm->_draw->spritesArray[30 + captureCount] = - _vm->_video->initSurfDesc(_vm->_global->videoMode, right - left + 1, height, 0); + _vm->_video->initSurfDesc(_vm->_global->_videoMode, right - left + 1, height, 0); _vm->_draw->sourceSurface = 21; _vm->_draw->destSurface = 30 + captureCount; @@ -413,7 +413,7 @@ void Game::interLoadSound(int16 slot) { id = _vm->_inter->load16(); if (id == -1) { - _vm->_global->inter_execPtr += 9; + _vm->_global->_inter_execPtr += 9; return; } @@ -463,7 +463,7 @@ int16 Game::checkKeys(int16 *pMouseX, int16 *pMouseY, int16 *pButtons, char hand _vm->_inter->_soundEndTimeKey = 0; } - if (_vm->_global->useMouse == 0) + if (_vm->_global->_useMouse == 0) error("checkKeys: Can't work without mouse!"); _vm->_util->getMouseState(pMouseX, pMouseY, pButtons); @@ -501,12 +501,12 @@ int16 Game::checkCollisions(char handleMouse, int16 deltaTime, int16 *pResId, &lastCollAreaIndex); if (lastCollKey != 0 && (lastCollId & 0x8000) != 0) { - savedIP = _vm->_global->inter_execPtr; - _vm->_global->inter_execPtr = (char *)totFileData + + savedIP = _vm->_global->_inter_execPtr; + _vm->_global->_inter_execPtr = (char *)totFileData + collisionAreas[lastCollAreaIndex].funcEnter; _vm->_inter->funcBlock(0); - _vm->_global->inter_execPtr = savedIP; + _vm->_global->_inter_execPtr = savedIP; } } @@ -547,7 +547,7 @@ int16 Game::checkCollisions(char handleMouse, int16 deltaTime, int16 *pResId, } } - key = checkKeys(&_vm->_global->inter_mouseX, &_vm->_global->inter_mouseY, + key = checkKeys(&_vm->_global->_inter_mouseX, &_vm->_global->_inter_mouseY, &mouseButtons, handleMouse); if (handleMouse == 0 && mouseButtons != 0) { @@ -568,12 +568,12 @@ int16 Game::checkCollisions(char handleMouse, int16 deltaTime, int16 *pResId, if (lastCollKey != 0 && collisionAreas[lastCollAreaIndex].funcLeave != 0) { - savedIP = _vm->_global->inter_execPtr; - _vm->_global->inter_execPtr = (char *)totFileData + + savedIP = _vm->_global->_inter_execPtr; + _vm->_global->_inter_execPtr = (char *)totFileData + collisionAreas[lastCollAreaIndex].funcLeave; _vm->_inter->funcBlock(0); - _vm->_global->inter_execPtr = savedIP; + _vm->_global->_inter_execPtr = savedIP; } lastCollKey = 0; @@ -609,13 +609,13 @@ int16 Game::checkCollisions(char handleMouse, int16 deltaTime, int16 *pResId, if (lastCollKey != 0 && collisionAreas[lastCollAreaIndex].funcLeave != 0) { - savedIP = _vm->_global->inter_execPtr; - _vm->_global->inter_execPtr = + savedIP = _vm->_global->_inter_execPtr; + _vm->_global->_inter_execPtr = (char *)totFileData + collisionAreas[lastCollAreaIndex].funcLeave; _vm->_inter->funcBlock(0); - _vm->_global->inter_execPtr = savedIP; + _vm->_global->_inter_execPtr = savedIP; } lastCollKey = 0; return key; @@ -623,13 +623,13 @@ int16 Game::checkCollisions(char handleMouse, int16 deltaTime, int16 *pResId, if (lastCollKey != 0 && collisionAreas[lastCollAreaIndex].funcLeave != 0) { - savedIP = _vm->_global->inter_execPtr; - _vm->_global->inter_execPtr = + savedIP = _vm->_global->_inter_execPtr; + _vm->_global->_inter_execPtr = (char *)totFileData + collisionAreas[lastCollAreaIndex].funcLeave; _vm->_inter->funcBlock(0); - _vm->_global->inter_execPtr = savedIP; + _vm->_global->_inter_execPtr = savedIP; } lastCollKey = @@ -638,19 +638,19 @@ int16 Game::checkCollisions(char handleMouse, int16 deltaTime, int16 *pResId, if (lastCollKey != 0 && (lastCollId & 0x8000) != 0) { - savedIP = _vm->_global->inter_execPtr; - _vm->_global->inter_execPtr = + savedIP = _vm->_global->_inter_execPtr; + _vm->_global->_inter_execPtr = (char *)totFileData + collisionAreas[lastCollAreaIndex].funcEnter; _vm->_inter->funcBlock(0); - _vm->_global->inter_execPtr = savedIP; + _vm->_global->_inter_execPtr = savedIP; } } else { if (handleMouse != 0 && - (_vm->_global->inter_mouseX != _vm->_draw->cursorX - || _vm->_global->inter_mouseY != _vm->_draw->cursorY)) { + (_vm->_global->_inter_mouseX != _vm->_draw->cursorX + || _vm->_global->_inter_mouseY != _vm->_draw->cursorY)) { oldIndex = lastCollAreaIndex; oldId = lastCollId; @@ -662,22 +662,22 @@ int16 Game::checkCollisions(char handleMouse, int16 deltaTime, int16 *pResId, if (key != lastCollKey) { if (lastCollKey != 0 && (oldId & 0x8000) != 0) { - savedIP = _vm->_global->inter_execPtr; - _vm->_global->inter_execPtr = (char *)totFileData + + savedIP = _vm->_global->_inter_execPtr; + _vm->_global->_inter_execPtr = (char *)totFileData + collisionAreas[oldIndex].funcLeave; _vm->_inter->funcBlock(0); - _vm->_global->inter_execPtr = savedIP; + _vm->_global->_inter_execPtr = savedIP; } lastCollKey = key; if (lastCollKey != 0 && (lastCollId & 0x8000) != 0) { - savedIP = _vm->_global->inter_execPtr; - _vm->_global->inter_execPtr = (char *)totFileData + + savedIP = _vm->_global->_inter_execPtr; + _vm->_global->_inter_execPtr = (char *)totFileData + collisionAreas[lastCollAreaIndex].funcEnter; _vm->_inter->funcBlock(0); - _vm->_global->inter_execPtr = savedIP; + _vm->_global->_inter_execPtr = savedIP; } } } @@ -708,7 +708,7 @@ int16 Game::inputArea(int16 xPos, int16 yPos, int16 width, int16 height, int16 b int16 savedKey; if (ghandleMouse != 0 && - (_vm->_global->useMouse != 0 || forceHandleMouse != 0)) + (_vm->_global->_useMouse != 0 || forceHandleMouse != 0)) handleMouse = 1; else handleMouse = 0; @@ -864,21 +864,21 @@ int16 Game::inputArea(int16 xPos, int16 yPos, int16 width, int16 height, int16 b return key; case 0x11b: // Escape - if (_vm->_global->useMouse != 0) + if (_vm->_global->_useMouse != 0) continue; forceHandleMouse = !forceHandleMouse; if (ghandleMouse != 0 && - (_vm->_global->useMouse != 0 || forceHandleMouse != 0)) + (_vm->_global->_useMouse != 0 || forceHandleMouse != 0)) handleMouse = 1; else handleMouse = 0; - if (_vm->_global->pressedKeys[1] == 0) + if (_vm->_global->_pressedKeys[1] == 0) continue; - while (_vm->_global->pressedKeys[1] != 0); + while (_vm->_global->_pressedKeys[1] != 0); continue; default: @@ -949,7 +949,7 @@ int16 Game::multiEdit(int16 time, int16 index, int16 *pCurPos, InputDesc * inpDe if ((collArea->flags & 0x0f) > 10) continue; - strcpy(tempStr, _vm->_global->inter_variables + collArea->key); + strcpy(tempStr, _vm->_global->_inter_variables + collArea->key); _vm->_draw->destSpriteX = collArea->left; _vm->_draw->destSpriteY = collArea->top; @@ -1009,7 +1009,7 @@ int16 Game::multiEdit(int16 time, int16 index, int16 *pCurPos, InputDesc * inpDe collArea->right - collArea->left + 1, collArea->bottom - collArea->top + 1, inpDesc[*pCurPos].backColor, inpDesc[*pCurPos].frontColor, - _vm->_global->inter_variables + collArea->key, + _vm->_global->_inter_variables + collArea->key, inpDesc[*pCurPos].fontIndex, collArea->flags, &time); if (_vm->_inter->_terminate) @@ -1135,21 +1135,21 @@ void Game::collisionsBlock(void) { pushCollisions(1); collResId = -1; - _vm->_global->inter_execPtr++; - count = *_vm->_global->inter_execPtr++; - ghandleMouse = _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]; + _vm->_global->_inter_execPtr++; + count = *_vm->_global->_inter_execPtr++; + ghandleMouse = _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]; if (stackPos2 != 0 || descIndex != 0) deltaTime /= 100; timeVal = deltaTime; - _vm->_global->inter_execPtr += 6; + _vm->_global->_inter_execPtr += 6; - startIP = _vm->_global->inter_execPtr; + startIP = _vm->_global->_inter_execPtr; WRITE_VAR(16, 0); var_22 = 0; index = 0; @@ -1157,12 +1157,12 @@ void Game::collisionsBlock(void) { for (curCmd = 0; curCmd < count; curCmd++) { array[curCmd] = 0; - cmd = *_vm->_global->inter_execPtr++; + cmd = *_vm->_global->_inter_execPtr++; if ((cmd & 0x40) != 0) { cmd -= 0x40; - cmdHigh = (byte)*_vm->_global->inter_execPtr; - _vm->_global->inter_execPtr++; + cmdHigh = (byte)*_vm->_global->_inter_execPtr; + _vm->_global->_inter_execPtr++; cmdHigh <<= 8; } else { cmdHigh = 0; @@ -1197,14 +1197,14 @@ void Game::collisionsBlock(void) { var_22 = 1; key = _vm->_parse->parseVarIndex(); descArray[index].fontIndex = _vm->_inter->load16(); - descArray[index].backColor = *_vm->_global->inter_execPtr++; - descArray[index].frontColor = *_vm->_global->inter_execPtr++; + descArray[index].backColor = *_vm->_global->_inter_execPtr++; + descArray[index].frontColor = *_vm->_global->_inter_execPtr++; if (cmd < 5 || cmd > 8) { descArray[index].ptr = 0; } else { - descArray[index].ptr = _vm->_global->inter_execPtr + 2; - _vm->_global->inter_execPtr += _vm->_inter->load16(); + descArray[index].ptr = _vm->_global->_inter_execPtr + 2; + _vm->_global->_inter_execPtr += _vm->_inter->load16(); } if (left == -1) @@ -1218,10 +1218,10 @@ void Game::collisionsBlock(void) { _vm->_draw->fonts[descArray[index].fontIndex]-> itemWidth - 1, top + height - 1, cmd, key, 0, - _vm->_global->inter_execPtr - (char *)totFileData); + _vm->_global->_inter_execPtr - (char *)totFileData); - _vm->_global->inter_execPtr += 2; - _vm->_global->inter_execPtr += READ_LE_UINT16(_vm->_global->inter_execPtr); + _vm->_global->_inter_execPtr += 2; + _vm->_global->_inter_execPtr += READ_LE_UINT16(_vm->_global->_inter_execPtr); } else { addNewCollision(curCmd + 0x8000, left, top, @@ -1243,10 +1243,10 @@ void Game::collisionsBlock(void) { left + width - 1, top + height - 1, (flags << 4) + cmdHigh + 2, key, - _vm->_global->inter_execPtr - (char *)totFileData, 0); + _vm->_global->_inter_execPtr - (char *)totFileData, 0); - _vm->_global->inter_execPtr += 2; - _vm->_global->inter_execPtr += READ_LE_UINT16(_vm->_global->inter_execPtr); + _vm->_global->_inter_execPtr += 2; + _vm->_global->_inter_execPtr += READ_LE_UINT16(_vm->_global->_inter_execPtr); break; case 20: @@ -1262,17 +1262,17 @@ void Game::collisionsBlock(void) { left + width - 1, top + height - 1, (flags << 4) + cmdHigh + 2, key, 0, - _vm->_global->inter_execPtr - (char *)totFileData); + _vm->_global->_inter_execPtr - (char *)totFileData); - _vm->_global->inter_execPtr += 2; - _vm->_global->inter_execPtr += READ_LE_UINT16(_vm->_global->inter_execPtr); + _vm->_global->_inter_execPtr += 2; + _vm->_global->_inter_execPtr += READ_LE_UINT16(_vm->_global->_inter_execPtr); break; case 0: - _vm->_global->inter_execPtr += 6; - startIP = _vm->_global->inter_execPtr; - _vm->_global->inter_execPtr += 2; - _vm->_global->inter_execPtr += READ_LE_UINT16(_vm->_global->inter_execPtr); + _vm->_global->_inter_execPtr += 6; + startIP = _vm->_global->_inter_execPtr; + _vm->_global->_inter_execPtr += 2; + _vm->_global->_inter_execPtr += READ_LE_UINT16(_vm->_global->_inter_execPtr); key = curCmd + 0xA000; addNewCollision(curCmd + 0x8000, left, top, @@ -1280,10 +1280,10 @@ void Game::collisionsBlock(void) { top + height - 1, cmd + cmdHigh, key, startIP - (char *)totFileData, - _vm->_global->inter_execPtr - (char *)totFileData); + _vm->_global->_inter_execPtr - (char *)totFileData); - _vm->_global->inter_execPtr += 2; - _vm->_global->inter_execPtr += READ_LE_UINT16(_vm->_global->inter_execPtr); + _vm->_global->_inter_execPtr += 2; + _vm->_global->_inter_execPtr += READ_LE_UINT16(_vm->_global->_inter_execPtr); break; case 1: @@ -1291,9 +1291,9 @@ void Game::collisionsBlock(void) { array[curCmd] = _vm->_inter->load16(); flags = _vm->_inter->load16() & 3; - startIP = _vm->_global->inter_execPtr; - _vm->_global->inter_execPtr += 2; - _vm->_global->inter_execPtr += READ_LE_UINT16(_vm->_global->inter_execPtr); + startIP = _vm->_global->_inter_execPtr; + _vm->_global->_inter_execPtr += 2; + _vm->_global->_inter_execPtr += READ_LE_UINT16(_vm->_global->_inter_execPtr); if (key == 0) key = curCmd + 0xa000; @@ -1302,10 +1302,10 @@ void Game::collisionsBlock(void) { top + height - 1, (flags << 4) + cmd + cmdHigh, key, startIP - (char *)totFileData, - _vm->_global->inter_execPtr - (char *)totFileData); + _vm->_global->_inter_execPtr - (char *)totFileData); - _vm->_global->inter_execPtr += 2; - _vm->_global->inter_execPtr += READ_LE_UINT16(_vm->_global->inter_execPtr); + _vm->_global->_inter_execPtr += 2; + _vm->_global->_inter_execPtr += READ_LE_UINT16(_vm->_global->_inter_execPtr); break; } } @@ -1411,15 +1411,15 @@ void Game::collisionsBlock(void) { activeCollResId = collPtr->id; activeCollIndex = i; - WRITE_VAR(2, _vm->_global->inter_mouseX); - WRITE_VAR(3, _vm->_global->inter_mouseY); + WRITE_VAR(2, _vm->_global->_inter_mouseX); + WRITE_VAR(3, _vm->_global->_inter_mouseY); WRITE_VAR(4, mouseButtons); WRITE_VAR(16, array[(uint16)activeCollResId & ~0x8000]); if (collPtr->funcLeave != 0) { timeKey = _vm->_util->getTimeKey(); - savedIP = _vm->_global->inter_execPtr; - _vm->_global->inter_execPtr = (char *)totFileData + collPtr->funcLeave; + savedIP = _vm->_global->_inter_execPtr; + _vm->_global->_inter_execPtr = (char *)totFileData + collPtr->funcLeave; shouldPushColls = 1; savedCollStackSize = collStackSize; _vm->_inter->funcBlock(0); @@ -1428,7 +1428,7 @@ void Game::collisionsBlock(void) { popCollisions(); shouldPushColls = 0; - _vm->_global->inter_execPtr = savedIP; + _vm->_global->_inter_execPtr = savedIP; deltaTime = timeVal - (_vm->_util->getTimeKey() - timeKey); if (deltaTime < 2) @@ -1500,14 +1500,14 @@ void Game::collisionsBlock(void) { if (collisionAreas[activeCollIndex].funcLeave != 0) continue; - WRITE_VAR(2, _vm->_global->inter_mouseX); - WRITE_VAR(3, _vm->_global->inter_mouseY); + WRITE_VAR(2, _vm->_global->_inter_mouseX); + WRITE_VAR(3, _vm->_global->_inter_mouseY); WRITE_VAR(4, mouseButtons); WRITE_VAR(16, array[(uint16)activeCollResId & ~0x8000]); if (collisionAreas[activeCollIndex].funcEnter != 0) { - savedIP = _vm->_global->inter_execPtr; - _vm->_global->inter_execPtr = (char *)totFileData + + savedIP = _vm->_global->_inter_execPtr; + _vm->_global->_inter_execPtr = (char *)totFileData + collisionAreas[activeCollIndex]. funcEnter; @@ -1518,7 +1518,7 @@ void Game::collisionsBlock(void) { if (collStackPos != collStackSize) popCollisions(); shouldPushColls = 0; - _vm->_global->inter_execPtr = savedIP; + _vm->_global->_inter_execPtr = savedIP; } WRITE_VAR(16, 0); @@ -1545,20 +1545,20 @@ void Game::collisionsBlock(void) { if ((collisionAreas[i].flags & 0x0f) > 8) { strcpy(tempStr, - _vm->_global->inter_variables + collisionAreas[i].key); + _vm->_global->_inter_variables + collisionAreas[i].key); while ((pos = _vm->_util->strstr(" ", tempStr)) != 0) { _vm->_util->cutFromStr(tempStr, pos - 1, 1); pos = _vm->_util->strstr(" ", tempStr); } - strcpy(_vm->_global->inter_variables + collisionAreas[i].key, tempStr); + strcpy(_vm->_global->_inter_variables + collisionAreas[i].key, tempStr); } if ((collisionAreas[i].flags & 0x0f) >= 5 && (collisionAreas[i].flags & 0x0f) <= 8) { str = descArray[var_24].ptr; - strcpy(tempStr, _vm->_global->inter_variables + collisionAreas[i].key); + strcpy(tempStr, _vm->_global->_inter_variables + collisionAreas[i].key); if ((collisionAreas[i].flags & 0x0f) < 7) _vm->_util->prepareStr(tempStr); @@ -1598,8 +1598,8 @@ void Game::collisionsBlock(void) { savedIP = (char *)totFileData + collisionAreas[activeCollIndex].funcLeave; - WRITE_VAR(2, _vm->_global->inter_mouseX); - WRITE_VAR(3, _vm->_global->inter_mouseY); + WRITE_VAR(2, _vm->_global->_inter_mouseX); + WRITE_VAR(3, _vm->_global->_inter_mouseY); WRITE_VAR(4, mouseButtons); if (VAR(16) == 0) { @@ -1610,7 +1610,7 @@ void Game::collisionsBlock(void) { for (curCmd = 0; curCmd < count; curCmd++) { freeCollision(curCmd + 0x8000); } - _vm->_global->inter_execPtr = savedIP; + _vm->_global->_inter_execPtr = savedIP; } void Game::prepareStart(void) { @@ -1618,25 +1618,25 @@ void Game::prepareStart(void) { clearCollisions(); - _vm->_global->pPaletteDesc->unused2 = _vm->_draw->unusedPalette2; - _vm->_global->pPaletteDesc->unused1 = _vm->_draw->unusedPalette1; - _vm->_global->pPaletteDesc->vgaPal = _vm->_draw->vgaPalette; + _vm->_global->_pPaletteDesc->unused2 = _vm->_draw->unusedPalette2; + _vm->_global->_pPaletteDesc->unused1 = _vm->_draw->unusedPalette1; + _vm->_global->_pPaletteDesc->vgaPal = _vm->_draw->vgaPalette; - _vm->_video->setFullPalette(_vm->_global->pPaletteDesc); + _vm->_video->setFullPalette(_vm->_global->_pPaletteDesc); - _vm->_draw->backSurface = _vm->_video->initSurfDesc(_vm->_global->videoMode, 320, 200, 0); + _vm->_draw->backSurface = _vm->_video->initSurfDesc(_vm->_global->_videoMode, 320, 200, 0); _vm->_video->fillRect(_vm->_draw->backSurface, 0, 0, 319, 199, 1); - _vm->_draw->frontSurface = _vm->_global->pPrimarySurfDesc; + _vm->_draw->frontSurface = _vm->_global->_pPrimarySurfDesc; _vm->_video->fillRect(_vm->_draw->frontSurface, 0, 0, 319, 199, 1); _vm->_util->setMousePos(152, 92); _vm->_draw->cursorX = 152; - _vm->_global->inter_mouseX = 152; + _vm->_global->_inter_mouseX = 152; _vm->_draw->cursorY = 92; - _vm->_global->inter_mouseY = 92; + _vm->_global->_inter_mouseY = 92; _vm->_draw->invalidatedCount = 0; _vm->_draw->noInvalidated = 1; _vm->_draw->applyPal = 0; @@ -1652,8 +1652,8 @@ void Game::prepareStart(void) { } _vm->_draw->cursorAnimLow[1] = 0; - _vm->_draw->cursorSprites = _vm->_video->initSurfDesc(_vm->_global->videoMode, 32, 16, 2); - _vm->_draw->cursorBack = _vm->_video->initSurfDesc(_vm->_global->videoMode, 16, 16, 0); + _vm->_draw->cursorSprites = _vm->_video->initSurfDesc(_vm->_global->_videoMode, 32, 16, 2); + _vm->_draw->cursorBack = _vm->_video->initSurfDesc(_vm->_global->_videoMode, 16, 16, 0); _vm->_draw->renderFlags = 0; _vm->_draw->backDeltaX = 0; _vm->_draw->backDeltaY = 0; @@ -1743,7 +1743,7 @@ void Game::playTot(int16 skipPlay) { oldNestLevel = _vm->_inter->_nestLevel; oldBreakFrom = _vm->_inter->_breakFromLevel; oldCaptureCounter = _vm->_scenery->pCaptureCounter; - savedIP = _vm->_global->inter_execPtr; + savedIP = _vm->_global->_inter_execPtr; _vm->_inter->_nestLevel = &nestLevel; _vm->_inter->_breakFromLevel = &breakFrom; @@ -1848,23 +1848,23 @@ void Game::playTot(int16 skipPlay) { loadImFile(); loadExtTable(); - _vm->_global->inter_animDataSize = READ_LE_UINT16((char *)totFileData + 0x38); - if (_vm->_global->inter_variables == 0) { + _vm->_global->_inter_animDataSize = READ_LE_UINT16((char *)totFileData + 0x38); + if (_vm->_global->_inter_variables == 0) { variablesCount = READ_LE_UINT32((char *)totFileData + 0x2c); - _vm->_global->inter_variables = (char *)malloc(variablesCount * 4); + _vm->_global->_inter_variables = (char *)malloc(variablesCount * 4); for (i = 0; i < variablesCount; i++) WRITE_VAR(i, 0); } - _vm->_global->inter_execPtr = (char *)totFileData; - _vm->_global->inter_execPtr += READ_LE_UINT32((char *)totFileData + 0x64); + _vm->_global->_inter_execPtr = (char *)totFileData; + _vm->_global->_inter_execPtr += READ_LE_UINT32((char *)totFileData + 0x64); _vm->_inter->renewTimeInVars(); - WRITE_VAR(13, _vm->_global->useMouse); - WRITE_VAR(14, _vm->_global->soundFlags); - WRITE_VAR(15, _vm->_global->videoMode); - WRITE_VAR(16, _vm->_global->language); + WRITE_VAR(13, _vm->_global->_useMouse); + WRITE_VAR(14, _vm->_global->_soundFlags); + WRITE_VAR(15, _vm->_global->_videoMode); + WRITE_VAR(16, _vm->_global->_language); _vm->_inter->callSub(2); @@ -1923,7 +1923,7 @@ void Game::playTot(int16 skipPlay) { _vm->_inter->_nestLevel = oldNestLevel; _vm->_inter->_breakFromLevel = oldBreakFrom; _vm->_scenery->pCaptureCounter = oldCaptureCounter; - _vm->_global->inter_execPtr = savedIP; + _vm->_global->_inter_execPtr = savedIP; } void Game::start(void) { diff --git a/gob/global.cpp b/gob/global.cpp index 13bfa2fe92..657e4f7962 100644 --- a/gob/global.cpp +++ b/gob/global.cpp @@ -25,129 +25,129 @@ namespace Gob { Global::Global(GobEngine *vm) : _vm(vm) { - useMouse = UNDEF; - mousePresent = UNDEF; + _useMouse = UNDEF; + _mousePresent = UNDEF; - presentCGA = UNDEF; - presentEGA = UNDEF; - presentVGA = UNDEF; - presentHER = UNDEF; + _presentCGA = UNDEF; + _presentEGA = UNDEF; + _presentVGA = UNDEF; + _presentHER = UNDEF; - videoMode = 0; + _videoMode = 0; /* Sound */ - presentSound = 0x8000; /* undefined values */ - soundFlags = 0x8000; - blasterPort = 0; - disableSoundCfg = 0; + _presentSound = 0x8000; /* undefined values */ + _soundFlags = 0x8000; + _blasterPort = 0; + _disableSoundCfg = 0; - //char playingSound = 0; + //char _playingSound = 0; /* Mouse */ - disableMouseCfg = 0; + _disableMouseCfg = 0; - mouseXShift = 3; - mouseYShift = 3; + _mouseXShift = 3; + _mouseYShift = 3; - mouseMaxCol = 320; - mouseMaxRow = 200; + _mouseMaxCol = 320; + _mouseMaxRow = 200; /* Language */ - disableLangCfg = 0x8000; - language = 0x8000; + _disableLangCfg = 0x8000; + _language = 0x8000; /* Timer variables */ - startTime = 0; - timer_delta = 1000; + _startTime = 0; + _timer_delta = 1000; - frameWaitTime = 0; - startFrameTime = 0; + _frameWaitTime = 0; + _startFrameTime = 0; /* Timer and delays */ - delayTime = 0; + _delayTime = 0; /* Joystick */ - useJoystick = 1; + _useJoystick = 1; /* Data files */ - packedSize = 0; + _packedSize = 0; for (int i = 0; i < MAX_DATA_FILES; i++) { - dataFiles[i] = 0; - numDataChunks[i] = 0; - dataFileHandles[i] = -1; + _dataFiles[i] = 0; + _numDataChunks[i] = 0; + _dataFileHandles[i] = -1; } - primaryWidth = 0; - primaryHeight = 0; - - sprAllocated = 0; - - doRangeClamp = 0; - - setAllPalette = 0; - - oldMode = 3; - dontSetPalette = 0; - curPrimaryDesc = 0; - allocatedPrimary = 0; - pPrimarySurfDesc = 0; - - pPaletteDesc = 0; - - unusedPalette1[0] = (int16)0; - unusedPalette1[1] = (int16)0x0b; - unusedPalette1[2] = (int16)0; - unusedPalette1[3] = (int16)0x5555; - unusedPalette1[4] = (int16)0xAAAA; - unusedPalette1[5] = (int16)0xFFFF; - unusedPalette1[6] = (int16)0; - unusedPalette1[7] = (int16)0x5555; - unusedPalette1[8] = (int16)0xAAAA; - unusedPalette1[9] = (int16)0xFFFF; - unusedPalette1[10] = (int16)0; - unusedPalette1[11] = (int16)0x5555; - unusedPalette1[12] = (int16)0xAAAA; - unusedPalette1[13] = (int16)0xFFFF; - unusedPalette1[14] = (int16)0; - unusedPalette1[15] = (int16)0x5555; - unusedPalette1[16] = (int16)0xAAAA; - unusedPalette1[17] = (int16)0xFFFF; + _primaryWidth = 0; + _primaryHeight = 0; + + _sprAllocated = 0; + + _doRangeClamp = 0; + + _setAllPalette = 0; + + _oldMode = 3; + _dontSetPalette = 0; + _curPrimaryDesc = 0; + _allocatedPrimary = 0; + _pPrimarySurfDesc = 0; + + _pPaletteDesc = 0; + + _unusedPalette1[0] = (int16)0; + _unusedPalette1[1] = (int16)0x0b; + _unusedPalette1[2] = (int16)0; + _unusedPalette1[3] = (int16)0x5555; + _unusedPalette1[4] = (int16)0xAAAA; + _unusedPalette1[5] = (int16)0xFFFF; + _unusedPalette1[6] = (int16)0; + _unusedPalette1[7] = (int16)0x5555; + _unusedPalette1[8] = (int16)0xAAAA; + _unusedPalette1[9] = (int16)0xFFFF; + _unusedPalette1[10] = (int16)0; + _unusedPalette1[11] = (int16)0x5555; + _unusedPalette1[12] = (int16)0xAAAA; + _unusedPalette1[13] = (int16)0xFFFF; + _unusedPalette1[14] = (int16)0; + _unusedPalette1[15] = (int16)0x5555; + _unusedPalette1[16] = (int16)0xAAAA; + _unusedPalette1[17] = (int16)0xFFFF; for (int i = 0; i < 16 ;i++) - unusedPalette2[i] = i; - - vgaPalette[0].red = 0x00; vgaPalette[0].green = 0x00; vgaPalette[0].blue = 0x00; - vgaPalette[1].red = 0x00; vgaPalette[1].green = 0x00; vgaPalette[1].blue = 0x2a; - vgaPalette[2].red = 0x00; vgaPalette[2].green = 0x2a; vgaPalette[2].blue = 0x00; - vgaPalette[3].red = 0x00; vgaPalette[3].green = 0x2a; vgaPalette[3].blue = 0x2a; - vgaPalette[4].red = 0x2a; vgaPalette[4].green = 0x00; vgaPalette[4].blue = 0x00; - vgaPalette[5].red = 0x2a; vgaPalette[5].green = 0x00; vgaPalette[5].blue = 0x2a; - vgaPalette[6].red = 0x2a; vgaPalette[6].green = 0x15; vgaPalette[6].blue = 0x00; - vgaPalette[7].red = 0x2a; vgaPalette[7].green = 0x2a; vgaPalette[7].blue = 0x2a; - vgaPalette[8].red = 0x15; vgaPalette[8].green = 0x15; vgaPalette[8].blue = 0x15; - vgaPalette[9].red = 0x15; vgaPalette[9].green = 0x15; vgaPalette[9].blue = 0x3f; - vgaPalette[10].red = 0x15; vgaPalette[10].green = 0x3f; vgaPalette[10].blue = 0x15; - vgaPalette[11].red = 0x15; vgaPalette[11].green = 0x3f; vgaPalette[11].blue = 0x3f; - vgaPalette[12].red = 0x3f; vgaPalette[12].green = 0x15; vgaPalette[12].blue = 0x15; - vgaPalette[13].red = 0x3f; vgaPalette[13].green = 0x15; vgaPalette[13].blue = 0x3f; - vgaPalette[14].red = 0x3f; vgaPalette[14].green = 0x3f; vgaPalette[14].blue = 0x15; - vgaPalette[15].red = 0x3f; vgaPalette[15].green = 0x3f; vgaPalette[15].blue = 0x3f; - - debugFlag = 0; - inVM = 0; - colorCount = 16; - - inter_resStr[0] = 0; - inter_resVal = 0; - - inter_variables = 0; - inter_execPtr = 0; - inter_animDataSize = 10; - - inter_mouseX = 0; - inter_mouseY = 0; - - tmpPalBuffer = 0; + _unusedPalette2[i] = i; + + _vgaPalette[0].red = 0x00; _vgaPalette[0].green = 0x00; _vgaPalette[0].blue = 0x00; + _vgaPalette[1].red = 0x00; _vgaPalette[1].green = 0x00; _vgaPalette[1].blue = 0x2a; + _vgaPalette[2].red = 0x00; _vgaPalette[2].green = 0x2a; _vgaPalette[2].blue = 0x00; + _vgaPalette[3].red = 0x00; _vgaPalette[3].green = 0x2a; _vgaPalette[3].blue = 0x2a; + _vgaPalette[4].red = 0x2a; _vgaPalette[4].green = 0x00; _vgaPalette[4].blue = 0x00; + _vgaPalette[5].red = 0x2a; _vgaPalette[5].green = 0x00; _vgaPalette[5].blue = 0x2a; + _vgaPalette[6].red = 0x2a; _vgaPalette[6].green = 0x15; _vgaPalette[6].blue = 0x00; + _vgaPalette[7].red = 0x2a; _vgaPalette[7].green = 0x2a; _vgaPalette[7].blue = 0x2a; + _vgaPalette[8].red = 0x15; _vgaPalette[8].green = 0x15; _vgaPalette[8].blue = 0x15; + _vgaPalette[9].red = 0x15; _vgaPalette[9].green = 0x15; _vgaPalette[9].blue = 0x3f; + _vgaPalette[10].red = 0x15; _vgaPalette[10].green = 0x3f; _vgaPalette[10].blue = 0x15; + _vgaPalette[11].red = 0x15; _vgaPalette[11].green = 0x3f; _vgaPalette[11].blue = 0x3f; + _vgaPalette[12].red = 0x3f; _vgaPalette[12].green = 0x15; _vgaPalette[12].blue = 0x15; + _vgaPalette[13].red = 0x3f; _vgaPalette[13].green = 0x15; _vgaPalette[13].blue = 0x3f; + _vgaPalette[14].red = 0x3f; _vgaPalette[14].green = 0x3f; _vgaPalette[14].blue = 0x15; + _vgaPalette[15].red = 0x3f; _vgaPalette[15].green = 0x3f; _vgaPalette[15].blue = 0x3f; + + _debugFlag = 0; + _inVM = 0; + _colorCount = 16; + + _inter_resStr[0] = 0; + _inter_resVal = 0; + + _inter_variables = 0; + _inter_execPtr = 0; + _inter_animDataSize = 10; + + _inter_mouseX = 0; + _inter_mouseY = 0; + + _tmpPalBuffer = 0; } } // End of namespace Gob diff --git a/gob/global.h b/gob/global.h index d6b9fd8d4c..8a8d3a91c1 100644 --- a/gob/global.h +++ b/gob/global.h @@ -65,105 +65,105 @@ namespace Gob { class Global { public: - char pressedKeys[128]; + char _pressedKeys[128]; - char useMouse; - int16 mousePresent; + char _useMouse; + int16 _mousePresent; - int16 presentCGA; - int16 presentEGA; - int16 presentVGA; - int16 presentHER; + int16 _presentCGA; + int16 _presentEGA; + int16 _presentVGA; + int16 _presentHER; - int16 videoMode; + int16 _videoMode; - int16 disableVideoCfg; + int16 _disableVideoCfg; - uint16 presentSound; - uint16 soundFlags; - int16 disableSoundCfg; - int16 blasterPort; + uint16 _presentSound; + uint16 _soundFlags; + int16 _disableSoundCfg; + int16 _blasterPort; - uint16 disableLangCfg; - uint16 language; + uint16 _disableLangCfg; + uint16 _language; // Timer variables - int32 startTime; - int16 timer_delta; + int32 _startTime; + int16 _timer_delta; - int16 frameWaitTime; - int32 startFrameTime; + int16 _frameWaitTime; + int32 _startFrameTime; // Mouse - int16 disableMouseCfg; + int16 _disableMouseCfg; - int16 mouseXShift; - int16 mouseYShift; - int16 mouseMaxCol; - int16 mouseMaxRow; + int16 _mouseXShift; + int16 _mouseYShift; + int16 _mouseMaxCol; + int16 _mouseMaxRow; // Timer and delays - int16 delayTime; + int16 _delayTime; // Joystick - char useJoystick; + char _useJoystick; // Files - Common::File filesHandles[MAX_FILES]; + Common::File _filesHandles[MAX_FILES]; // Data files - struct DataIO::ChunkDesc *dataFiles[MAX_DATA_FILES]; - int16 numDataChunks[MAX_DATA_FILES]; - int16 dataFileHandles[MAX_DATA_FILES]; - int32 chunkPos[MAX_SLOT_COUNT * MAX_DATA_FILES]; - int32 chunkOffset[MAX_SLOT_COUNT * MAX_DATA_FILES]; - int32 chunkSize[MAX_SLOT_COUNT * MAX_DATA_FILES]; - char isCurrentSlot[MAX_SLOT_COUNT * MAX_DATA_FILES]; - int32 packedSize; + struct DataIO::ChunkDesc *_dataFiles[MAX_DATA_FILES]; + int16 _numDataChunks[MAX_DATA_FILES]; + int16 _dataFileHandles[MAX_DATA_FILES]; + int32 _chunkPos[MAX_SLOT_COUNT * MAX_DATA_FILES]; + int32 _chunkOffset[MAX_SLOT_COUNT * MAX_DATA_FILES]; + int32 _chunkSize[MAX_SLOT_COUNT * MAX_DATA_FILES]; + char _isCurrentSlot[MAX_SLOT_COUNT * MAX_DATA_FILES]; + int32 _packedSize; - int16 sprAllocated; + int16 _sprAllocated; - int16 primaryWidth; - int16 primaryHeight; + int16 _primaryWidth; + int16 _primaryHeight; - int16 doRangeClamp; + int16 _doRangeClamp; - char redPalette[256]; - char greenPalette[256]; - char bluePalette[256]; + char _redPalette[256]; + char _greenPalette[256]; + char _bluePalette[256]; - int16 setAllPalette; + int16 _setAllPalette; - Video::SurfaceDesc *curPrimaryDesc; - Video::SurfaceDesc *allocatedPrimary; - Video::SurfaceDesc_t primarySurfDesc; - Video::SurfaceDesc *pPrimarySurfDesc; + Video::SurfaceDesc *_curPrimaryDesc; + Video::SurfaceDesc *_allocatedPrimary; + Video::SurfaceDesc_t _primarySurfDesc; + Video::SurfaceDesc *_pPrimarySurfDesc; - int16 oldMode; - char dontSetPalette; + int16 _oldMode; + char _dontSetPalette; - Video::PalDesc *pPaletteDesc; + Video::PalDesc *_pPaletteDesc; - int16 unusedPalette1[18]; - int16 unusedPalette2[16]; - Video::Color vgaPalette[16]; - Video::PalDesc paletteStruct; + int16 _unusedPalette1[18]; + int16 _unusedPalette2[16]; + Video::Color _vgaPalette[16]; + Video::PalDesc _paletteStruct; - int16 debugFlag; - int16 inVM; - int16 colorCount; + int16 _debugFlag; + int16 _inVM; + int16 _colorCount; - char inter_resStr[200]; - int32 inter_resVal; + char _inter_resStr[200]; + int32 _inter_resVal; - char *inter_variables; - char *inter_execPtr; - int16 inter_animDataSize; + char *_inter_variables; + char *_inter_execPtr; + int16 _inter_animDataSize; - int16 inter_mouseX; - int16 inter_mouseY; + int16 _inter_mouseX; + int16 _inter_mouseY; - char *tmpPalBuffer; + char *_tmpPalBuffer; Global(GobEngine *vm); diff --git a/gob/gob.cpp b/gob/gob.cpp index a4815eda27..ed6a24bd3b 100644 --- a/gob/gob.cpp +++ b/gob/gob.cpp @@ -303,30 +303,29 @@ int GobEngine::init(GameDetector &detector) { if (cd_num >= 0) _system->openCD(cd_num); - _global->debugFlag = 1; - _global->doRangeClamp = 1; + _global->_debugFlag = 1; + _global->_doRangeClamp = 1; - _global->videoMode = 0x13; - _snd->soundPort = 1; - _global->useMouse = 1; - _global->soundFlags = 0; + _global->_videoMode = 0x13; + _global->_useMouse = 1; + _global->_soundFlags = 0; switch (Common::parseLanguage(ConfMan.get("language"))) { case Common::FR_FRA: - _global->language = 0; + _global->_language = 0; break; case Common::DE_DEU: - _global->language = 1; + _global->_language = 1; break; case Common::ES_ESP: - _global->language = 3; + _global->_language = 3; break; case Common::IT_ITA: - _global->language = 4; + _global->_language = 4; break; default: // Default to English - _global->language = 2; + _global->_language = 2; break; } @@ -55,7 +55,7 @@ class Scenery; class GTimer; class Util; -#define VAR_OFFSET(offs) (*(uint32 *)(_vm->_global->inter_variables + (offs))) +#define VAR_OFFSET(offs) (*(uint32 *)(_vm->_global->_inter_variables + (offs))) #define VAR(var) VAR_OFFSET((var) << 2) #define VAR_ADDRESS(var) (&VAR(var)) diff --git a/gob/goblin.cpp b/gob/goblin.cpp index ba60851fcf..91597d8f13 100644 --- a/gob/goblin.cpp +++ b/gob/goblin.cpp @@ -162,10 +162,10 @@ int16 Goblin::peekGoblin(Gob_Object *curGob) { if (desc != goblins[i]) continue; - if (_vm->_global->inter_mouseX < desc->right && - _vm->_global->inter_mouseX > desc->left && - _vm->_global->inter_mouseY < desc->bottom && - _vm->_global->inter_mouseY > desc->top) { + if (_vm->_global->_inter_mouseX < desc->right && + _vm->_global->_inter_mouseX > desc->left && + _vm->_global->_inter_mouseY < desc->bottom && + _vm->_global->_inter_mouseY > desc->top) { index = i + 1; } } @@ -1079,10 +1079,10 @@ void Goblin::moveFindItem(int16 posX, int16 posY) { void Goblin::moveCheckSelect(int16 framesCount, Gob_Object * gobDesc, int16 *pGobIndex, int16 *nextAct) { - if (gobDesc->right > _vm->_global->inter_mouseX && - gobDesc->left < _vm->_global->inter_mouseX && - gobDesc->bottom > _vm->_global->inter_mouseY && - gobDesc->bottom - 10 < _vm->_global->inter_mouseY && gobAction == 0) { + if (gobDesc->right > _vm->_global->_inter_mouseX && + gobDesc->left < _vm->_global->_inter_mouseX && + gobDesc->bottom > _vm->_global->_inter_mouseY && + gobDesc->bottom - 10 < _vm->_global->_inter_mouseY && gobAction == 0) { if (gobDesc->curLookDir & 4) *nextAct = 16; else @@ -1125,14 +1125,14 @@ void Goblin::moveInitStep(int16 framesCount, int16 action, int16 cont, forceNextState[2] = -1; if (action == 3) { - posX = _vm->_global->inter_mouseX + 6; - posY = _vm->_global->inter_mouseY + 7; + posX = _vm->_global->_inter_mouseX + 6; + posY = _vm->_global->_inter_mouseY + 7; } else if (action == 4) { - posX = _vm->_global->inter_mouseX + 7; - posY = _vm->_global->inter_mouseY + 12; + posX = _vm->_global->_inter_mouseX + 7; + posY = _vm->_global->_inter_mouseY + 12; } else { - posX = _vm->_global->inter_mouseX; - posY = _vm->_global->inter_mouseY; + posX = _vm->_global->_inter_mouseX; + posY = _vm->_global->_inter_mouseY; } moveFindItem(posX, posY); @@ -2394,7 +2394,7 @@ void Goblin::interFunc(void) { retVarPtr = (int32 *)VAR_ADDRESS(59); cmd = _vm->_inter->load16(); - _vm->_global->inter_execPtr += 2; + _vm->_global->_inter_execPtr += 2; if (cmd > 0 && cmd < 17) { extraData = _vm->_inter->load16(); objDesc = objects[extraData]; @@ -3247,9 +3247,9 @@ void Goblin::interFunc(void) { default: warning("interFunc: Unknown command %d!", cmd); - _vm->_global->inter_execPtr -= 2; + _vm->_global->_inter_execPtr -= 2; cmd = _vm->_inter->load16(); - _vm->_global->inter_execPtr += cmd * 2; + _vm->_global->_inter_execPtr += cmd * 2; break; } return; diff --git a/gob/init.cpp b/gob/init.cpp index f038b7ca51..9733cf67cb 100644 --- a/gob/init.cpp +++ b/gob/init.cpp @@ -36,92 +36,92 @@ namespace Gob { void game_start(void); -const char *Init::fontNames[] = { "jeulet1.let", "jeulet2.let", "jeucar1.let", "jeumath.let" }; +const char *Init::_fontNames[] = { "jeulet1.let", "jeulet2.let", "jeucar1.let", "jeumath.let" }; Init::Init(GobEngine *vm) : _vm(vm) { - palDesc = 0; + _palDesc = 0; } void Init::findBestCfg(void) { - _vm->_global->videoMode = VIDMODE_VGA; - _vm->_global->useMouse = _vm->_global->mousePresent; - if (_vm->_global->presentSound & BLASTER_FLAG) - _vm->_global->soundFlags = BLASTER_FLAG | SPEAKER_FLAG | MIDI_FLAG; - else if (_vm->_global->presentSound & PROAUDIO_FLAG) - _vm->_global->soundFlags = PROAUDIO_FLAG | SPEAKER_FLAG | MIDI_FLAG; - else if (_vm->_global->presentSound & ADLIB_FLAG) - _vm->_global->soundFlags = ADLIB_FLAG | SPEAKER_FLAG | MIDI_FLAG; - else if (_vm->_global->presentSound & INTERSOUND_FLAG) - _vm->_global->soundFlags = INTERSOUND_FLAG | SPEAKER_FLAG; - else if (_vm->_global->presentSound & SPEAKER_FLAG) - _vm->_global->soundFlags = SPEAKER_FLAG; + _vm->_global->_videoMode = VIDMODE_VGA; + _vm->_global->_useMouse = _vm->_global->_mousePresent; + if (_vm->_global->_presentSound & BLASTER_FLAG) + _vm->_global->_soundFlags = BLASTER_FLAG | SPEAKER_FLAG | MIDI_FLAG; + else if (_vm->_global->_presentSound & PROAUDIO_FLAG) + _vm->_global->_soundFlags = PROAUDIO_FLAG | SPEAKER_FLAG | MIDI_FLAG; + else if (_vm->_global->_presentSound & ADLIB_FLAG) + _vm->_global->_soundFlags = ADLIB_FLAG | SPEAKER_FLAG | MIDI_FLAG; + else if (_vm->_global->_presentSound & INTERSOUND_FLAG) + _vm->_global->_soundFlags = INTERSOUND_FLAG | SPEAKER_FLAG; + else if (_vm->_global->_presentSound & SPEAKER_FLAG) + _vm->_global->_soundFlags = SPEAKER_FLAG; else - _vm->_global->soundFlags = 0; + _vm->_global->_soundFlags = 0; } void Init::soundVideo(int32 smallHeap, int16 flag) { - if (_vm->_global->videoMode != 0x13 && _vm->_global->videoMode != 0) + if (_vm->_global->_videoMode != 0x13 && _vm->_global->_videoMode != 0) error("soundVideo: Video mode 0x%x is not supported!", - _vm->_global->videoMode); + _vm->_global->_videoMode); //if ((flag & 4) == 0) // _vm->_video->findVideo(); - _vm->_global->mousePresent = 1; + _vm->_global->_mousePresent = 1; - _vm->_global->inVM = 0; + _vm->_global->_inVM = 0; - _vm->_global->presentSound = 0; // FIXME: sound is not supported yet + _vm->_global->_presentSound = 0; // FIXME: sound is not supported yet - _vm->_global->sprAllocated = 0; + _vm->_global->_sprAllocated = 0; _vm->_gtimer->enableTimer(); // _vm->_snd->setResetTimerFlag(debugFlag); // TODO - if (_vm->_global->videoMode == 0x13) - _vm->_global->colorCount = 256; + if (_vm->_global->_videoMode == 0x13) + _vm->_global->_colorCount = 256; - _vm->_global->pPaletteDesc = &_vm->_global->paletteStruct; - _vm->_global->pPaletteDesc->vgaPal = _vm->_global->vgaPalette; - _vm->_global->pPaletteDesc->unused1 = _vm->_global->unusedPalette1; - _vm->_global->pPaletteDesc->unused2 = _vm->_global->unusedPalette2; - _vm->_global->pPrimarySurfDesc = &_vm->_global->primarySurfDesc; + _vm->_global->_pPaletteDesc = &_vm->_global->_paletteStruct; + _vm->_global->_pPaletteDesc->vgaPal = _vm->_global->_vgaPalette; + _vm->_global->_pPaletteDesc->unused1 = _vm->_global->_unusedPalette1; + _vm->_global->_pPaletteDesc->unused2 = _vm->_global->_unusedPalette2; + _vm->_global->_pPrimarySurfDesc = &_vm->_global->_primarySurfDesc; - if (_vm->_global->videoMode != 0) - _vm->_video->initSurfDesc(_vm->_global->videoMode, 320, 200, PRIMARY_SURFACE); + if (_vm->_global->_videoMode != 0) + _vm->_video->initSurfDesc(_vm->_global->_videoMode, 320, 200, PRIMARY_SURFACE); - if (_vm->_global->soundFlags & MIDI_FLAG) { - _vm->_global->soundFlags &= _vm->_global->presentSound; - if (_vm->_global->presentSound & ADLIB_FLAG) - _vm->_global->soundFlags |= MIDI_FLAG; + if (_vm->_global->_soundFlags & MIDI_FLAG) { + _vm->_global->_soundFlags &= _vm->_global->_presentSound; + if (_vm->_global->_presentSound & ADLIB_FLAG) + _vm->_global->_soundFlags |= MIDI_FLAG; } else { - _vm->_global->soundFlags &= _vm->_global->presentSound; + _vm->_global->_soundFlags &= _vm->_global->_presentSound; } } void Init::cleanup(void) { - if (_vm->_global->debugFlag == 0) + if (_vm->_global->_debugFlag == 0) _vm->_gtimer->disableTimer(); _vm->_video->freeDriver(); - if (_vm->_global->curPrimaryDesc != 0) { - _vm->_video->freeSurfDesc(_vm->_global->curPrimaryDesc); - _vm->_video->freeSurfDesc(_vm->_global->allocatedPrimary); - _vm->_global->allocatedPrimary = 0; - _vm->_global->curPrimaryDesc = 0; + if (_vm->_global->_curPrimaryDesc != 0) { + _vm->_video->freeSurfDesc(_vm->_global->_curPrimaryDesc); + _vm->_video->freeSurfDesc(_vm->_global->_allocatedPrimary); + _vm->_global->_allocatedPrimary = 0; + _vm->_global->_curPrimaryDesc = 0; } - _vm->_global->pPrimarySurfDesc = 0; - if (_vm->_snd->cleanupFunc != 0 && _vm->_snd->playingSound != 0) { - (*_vm->_snd->cleanupFunc) (0); - _vm->_snd->cleanupFunc = 0; + _vm->_global->_pPrimarySurfDesc = 0; + if (_vm->_snd->_cleanupFunc != 0 && _vm->_snd->_playingSound != 0) { + (*_vm->_snd->_cleanupFunc) (0); + _vm->_snd->_cleanupFunc = 0; } _vm->_snd->speakerOff(); _vm->_dataio->closeDataFile(); - if (_vm->_global->sprAllocated != 0) + if (_vm->_global->_sprAllocated != 0) error("cleanup: Error! Allocated sprites left: %d", - _vm->_global->sprAllocated); + _vm->_global->_sprAllocated); _vm->_snd->stopSound(0); _vm->_util->keyboard_release(); @@ -151,8 +151,8 @@ numFromTot = word ptr -0Ah memAvail = dword ptr -6 memBlocks = word ptr -2*/ - _vm->_global->disableVideoCfg = 0x11; - _vm->_global->disableMouseCfg = 0x15; + _vm->_global->_disableVideoCfg = 0x11; + _vm->_global->_disableMouseCfg = 0x15; soundVideo(1000, 1); handle2 = _vm->_dataio->openData("intro.stk"); @@ -164,23 +164,23 @@ memBlocks = word ptr -2*/ _vm->_util->initInput(); _vm->_video->setHandlers(); - _vm->_video->initPrimary(_vm->_global->videoMode); - _vm->_global->mouseXShift = 1; - _vm->_global->mouseYShift = 1; + _vm->_video->initPrimary(_vm->_global->_videoMode); + _vm->_global->_mouseXShift = 1; + _vm->_global->_mouseYShift = 1; _vm->_game->totTextData = 0; _vm->_game->totFileData = 0; _vm->_game->totResourceTable = 0; - _vm->_global->inter_variables = 0; - palDesc = (Video::PalDesc *)malloc(12); + _vm->_global->_inter_variables = 0; + _palDesc = (Video::PalDesc *)malloc(12); - if (_vm->_global->videoMode != 0x13) + if (_vm->_global->_videoMode != 0x13) error("initGame: Only 0x13 video mode is supported!"); - palDesc->vgaPal = _vm->_draw->vgaPalette; - palDesc->unused1 = _vm->_draw->unusedPalette1; - palDesc->unused2 = _vm->_draw->unusedPalette2; - _vm->_video->setFullPalette(palDesc); + _palDesc->vgaPal = _vm->_draw->vgaPalette; + _palDesc->unused1 = _vm->_draw->unusedPalette1; + _palDesc->unused2 = _vm->_draw->unusedPalette2; + _vm->_video->setFullPalette(_palDesc); for (i = 0; i < 4; i++) _vm->_draw->fonts[i] = 0; @@ -189,11 +189,11 @@ memBlocks = word ptr -2*/ if (handle < 0) { for (i = 0; i < 4; i++) { - handle2 = _vm->_dataio->openData(fontNames[i]); + handle2 = _vm->_dataio->openData(_fontNames[i]); if (handle2 >= 0) { _vm->_dataio->closeData(handle2); _vm->_draw->fonts[i] = - _vm->_util->loadFont(fontNames[i]); + _vm->_util->loadFont(_fontNames[i]); } } } else { @@ -244,8 +244,8 @@ memBlocks = word ptr -2*/ varsCount = FROM_LE_32(varsCount); _vm->_dataio->closeData(handle); - _vm->_global->inter_variables = (char *)malloc(varsCount * 4); - memset(_vm->_global->inter_variables, 0, varsCount * 4); + _vm->_global->_inter_variables = (char *)malloc(varsCount * 4); + memset(_vm->_global->_inter_variables, 0, varsCount * 4); strcpy(_vm->_game->curTotFile, buffer); @@ -256,7 +256,7 @@ memBlocks = word ptr -2*/ _vm->_cdrom->stopPlaying(); _vm->_cdrom->freeLICbuffer(); - free(_vm->_global->inter_variables); + free(_vm->_global->_inter_variables); free(_vm->_game->totFileData); free(_vm->_game->totTextData); free(_vm->_game->totResourceTable); @@ -267,7 +267,7 @@ memBlocks = word ptr -2*/ _vm->_util->freeFont(_vm->_draw->fonts[i]); } - free(palDesc); + free(_palDesc); _vm->_dataio->closeDataFile(); _vm->_video->initPrimary(-1); cleanup(); diff --git a/gob/init.h b/gob/init.h index 964ea0f582..7a81191043 100644 --- a/gob/init.h +++ b/gob/init.h @@ -34,8 +34,8 @@ public: Init(GobEngine *vm); protected: - Video::PalDesc *palDesc; - static const char *fontNames[4]; + Video::PalDesc *_palDesc; + static const char *_fontNames[4]; GobEngine *_vm; void cleanup(void); diff --git a/gob/inter.cpp b/gob/inter.cpp index 292e94efe1..82b829f5b7 100644 --- a/gob/inter.cpp +++ b/gob/inter.cpp @@ -46,16 +46,16 @@ Inter::Inter(GobEngine *vm) : _vm(vm) { } int16 Inter::load16(void) { - int16 tmp = (int16)READ_LE_UINT16(_vm->_global->inter_execPtr); - _vm->_global->inter_execPtr += 2; + int16 tmp = (int16)READ_LE_UINT16(_vm->_global->_inter_execPtr); + _vm->_global->_inter_execPtr += 2; return tmp; } void Inter::setMousePos(void) { - _vm->_global->inter_mouseX = _vm->_parse->parseValExpr(); - _vm->_global->inter_mouseY = _vm->_parse->parseValExpr(); - if (_vm->_global->useMouse != 0) - _vm->_util->setMousePos(_vm->_global->inter_mouseX, _vm->_global->inter_mouseY); + _vm->_global->_inter_mouseX = _vm->_parse->parseValExpr(); + _vm->_global->_inter_mouseY = _vm->_parse->parseValExpr(); + if (_vm->_global->_useMouse != 0) + _vm->_util->setMousePos(_vm->_global->_inter_mouseX, _vm->_global->_inter_mouseY); } char Inter::evalExpr(int16 *pRes) { @@ -70,7 +70,7 @@ char Inter::evalExpr(int16 *pRes) { switch (token) { case 20: - *pRes = _vm->_global->inter_resVal; + *pRes = _vm->_global->_inter_resVal; break; case 22: @@ -91,7 +91,7 @@ char Inter::evalBoolResult() { _vm->_parse->printExpr(99); _vm->_parse->parseExpr(99, &token); - if (token == 24 || (token == 20 && _vm->_global->inter_resVal != 0)) + if (token == 24 || (token == 20 && _vm->_global->_inter_resVal != 0)) return 1; else return 0; @@ -103,21 +103,21 @@ void Inter::evaluateStore(void) { int16 result; int16 varOff; - savedPos = _vm->_global->inter_execPtr; + savedPos = _vm->_global->_inter_execPtr; varOff = _vm->_parse->parseVarIndex(); token = evalExpr(&result); switch (savedPos[0]) { case 23: case 26: - WRITE_VAR_OFFSET(varOff, _vm->_global->inter_resVal); + WRITE_VAR_OFFSET(varOff, _vm->_global->_inter_resVal); break; case 25: case 28: if (token == 20) - *(_vm->_global->inter_variables + varOff) = result; + *(_vm->_global->_inter_variables + varOff) = result; else - strcpy(_vm->_global->inter_variables + varOff, _vm->_global->inter_resStr); + strcpy(_vm->_global->_inter_variables + varOff, _vm->_global->_inter_resStr); break; } @@ -166,14 +166,14 @@ void Inter::printText(void) { } do { - for (i = 0; *_vm->_global->inter_execPtr != '.' && (byte)*_vm->_global->inter_execPtr != 200; - i++, _vm->_global->inter_execPtr++) { - buf[i] = *_vm->_global->inter_execPtr; + for (i = 0; *_vm->_global->_inter_execPtr != '.' && (byte)*_vm->_global->_inter_execPtr != 200; + i++, _vm->_global->_inter_execPtr++) { + buf[i] = *_vm->_global->_inter_execPtr; } - if ((byte)*_vm->_global->inter_execPtr != 200) { - _vm->_global->inter_execPtr++; - switch (*_vm->_global->inter_execPtr) { + if ((byte)*_vm->_global->_inter_execPtr != 200) { + _vm->_global->_inter_execPtr++; + switch (*_vm->_global->_inter_execPtr) { case 23: case 26: sprintf(buf + i, "%d", VAR_OFFSET(_vm->_parse->parseVarIndex())); @@ -181,16 +181,16 @@ void Inter::printText(void) { case 25: case 28: - sprintf(buf + i, "%s", _vm->_global->inter_variables + _vm->_parse->parseVarIndex()); + sprintf(buf + i, "%s", _vm->_global->_inter_variables + _vm->_parse->parseVarIndex()); break; } - _vm->_global->inter_execPtr++; + _vm->_global->_inter_execPtr++; } else { buf[i] = 0; } _vm->_draw->spriteOperation(DRAW_PRINTTEXT); - } while ((byte)*_vm->_global->inter_execPtr != 200); - _vm->_global->inter_execPtr++; + } while ((byte)*_vm->_global->_inter_execPtr != 200); + _vm->_global->_inter_execPtr++; } void Inter::animPalette(void) { @@ -200,7 +200,7 @@ void Inter::animPalette(void) { if (_animPalDir == 0) return; - _vm->_video->waitRetrace(_vm->_global->videoMode); + _vm->_video->waitRetrace(_vm->_global->_videoMode); if (_animPalDir == -1) { col = _vm->_draw->vgaSmallPalette[_animPalLowIndex]; @@ -217,8 +217,8 @@ void Inter::animPalette(void) { _vm->_draw->vgaSmallPalette[_animPalLowIndex] = col; } - _vm->_global->pPaletteDesc->vgaPal = _vm->_draw->vgaSmallPalette; - _vm->_video->setFullPalette(_vm->_global->pPaletteDesc); + _vm->_global->_pPaletteDesc->vgaPal = _vm->_draw->vgaSmallPalette; + _vm->_video->setFullPalette(_vm->_global->_pPaletteDesc); } void Inter::animPalInit(void) { @@ -285,12 +285,12 @@ void Inter::initCursor(void) { count -= 0x80; _vm->_draw->cursorSprites = - _vm->_video->initSurfDesc(_vm->_global->videoMode, _vm->_draw->cursorWidth * count, + _vm->_video->initSurfDesc(_vm->_global->_videoMode, _vm->_draw->cursorWidth * count, _vm->_draw->cursorHeight, 2); _vm->_draw->spritesArray[23] = _vm->_draw->cursorSprites; _vm->_draw->cursorBack = - _vm->_video->initSurfDesc(_vm->_global->videoMode, _vm->_draw->cursorWidth, + _vm->_video->initSurfDesc(_vm->_global->_videoMode, _vm->_draw->cursorWidth, _vm->_draw->cursorHeight, 0); for (i = 0; i < 40; i++) { _vm->_draw->cursorAnimLow[i] = -1; @@ -323,7 +323,7 @@ void Inter::drawOperations(void) { byte cmd; int16 i; - cmd = *_vm->_global->inter_execPtr++; + cmd = *_vm->_global->_inter_execPtr++; debug(4, "drawOperations(%d)", cmd); @@ -420,7 +420,7 @@ void Inter::drawOperations(void) { if (_vm->_features & GF_GOB1) { // Used in gob1 CD evalExpr(0); - _vm->_cdrom->startTrack(_vm->_global->inter_resStr); + _vm->_cdrom->startTrack(_vm->_global->_inter_resStr); } else { } break; @@ -602,8 +602,8 @@ void Inter::getFreeMem(void) { void Inter::manageDataFile(void) { evalExpr(0); - if (_vm->_global->inter_resStr[0] != 0) - _vm->_dataio->openDataFile(_vm->_global->inter_resStr); + if (_vm->_global->_inter_resStr[0] != 0) + _vm->_dataio->openDataFile(_vm->_global->_inter_resStr); else _vm->_dataio->closeDataFile(); } @@ -622,7 +622,7 @@ void Inter::writeData(void) { offset = _vm->_parse->parseValExpr(); WRITE_VAR(1, 1); - handle = _vm->_dataio->openData(_vm->_global->inter_resStr, Common::File::kFileWriteMode); + handle = _vm->_dataio->openData(_vm->_global->_inter_resStr, Common::File::kFileWriteMode); if (handle < 0) return; @@ -633,7 +633,7 @@ void Inter::writeData(void) { _vm->_dataio->seekData(handle, offset, 0); } - retSize = _vm->_dataio->file_getHandle(handle)->write(_vm->_global->inter_variables + dataVar, size); + retSize = _vm->_dataio->file_getHandle(handle)->write(_vm->_global->_inter_variables + dataVar, size); if (retSize == size) WRITE_VAR(1, 0); @@ -648,7 +648,7 @@ void Inter::checkData(void) { debug(4, "_vm->_dataio->cheackData"); evalExpr(0); varOff = _vm->_parse->parseVarIndex(); - handle = _vm->_dataio->openData(_vm->_global->inter_resStr); + handle = _vm->_dataio->openData(_vm->_global->_inter_resStr); WRITE_VAR_OFFSET(varOff, handle); if (handle >= 0) @@ -672,7 +672,7 @@ void Inter::readData(void) { _vm->_dataio->closeData(_vm->_game->extHandle); WRITE_VAR(1, 1); - handle = _vm->_dataio->openData(_vm->_global->inter_resStr); + handle = _vm->_dataio->openData(_vm->_global->_inter_resStr); if (handle >= 0) { _vm->_draw->animateCursor(4); if (offset < 0) @@ -680,7 +680,7 @@ void Inter::readData(void) { else _vm->_dataio->seekData(handle, offset, 0); - retSize = _vm->_dataio->readData(handle, _vm->_global->inter_variables + dataVar, size); + retSize = _vm->_dataio->readData(handle, _vm->_global->_inter_variables + dataVar, size); _vm->_dataio->closeData(handle); if (retSize == size) @@ -705,7 +705,7 @@ void Inter::loadFont(void) { if (_vm->_game->extHandle >= 0) _vm->_dataio->closeData(_vm->_game->extHandle); - _vm->_draw->fonts[index] = _vm->_util->loadFont(_vm->_global->inter_resStr); + _vm->_draw->fonts[index] = _vm->_util->loadFont(_vm->_global->_inter_resStr); if (_vm->_game->extHandle >= 0) _vm->_game->extHandle = _vm->_dataio->openData(_vm->_game->curExtFile); @@ -725,7 +725,7 @@ void Inter::prepareStr(void) { int16 var; var = _vm->_parse->parseVarIndex(); - _vm->_util->prepareStr(_vm->_global->inter_variables + var); + _vm->_util->prepareStr(_vm->_global->_inter_variables + var); } void Inter::insertStr(void) { @@ -735,7 +735,7 @@ void Inter::insertStr(void) { strVar = _vm->_parse->parseVarIndex(); evalExpr(0); pos = _vm->_parse->parseValExpr(); - _vm->_util->insertStr(_vm->_global->inter_resStr, _vm->_global->inter_variables + strVar, pos); + _vm->_util->insertStr(_vm->_global->_inter_resStr, _vm->_global->_inter_variables + strVar, pos); } void Inter::cutStr(void) { @@ -746,7 +746,7 @@ void Inter::cutStr(void) { var = _vm->_parse->parseVarIndex(); pos = _vm->_parse->parseValExpr(); size = _vm->_parse->parseValExpr(); - _vm->_util->cutFromStr(_vm->_global->inter_variables + var, pos, size); + _vm->_util->cutFromStr(_vm->_global->_inter_variables + var, pos, size); } void Inter::strstr(void) { @@ -758,7 +758,7 @@ void Inter::strstr(void) { evalExpr(0); resVar = _vm->_parse->parseVarIndex(); - pos = _vm->_util->strstr(_vm->_global->inter_resStr, _vm->_global->inter_variables + strVar); + pos = _vm->_util->strstr(_vm->_global->_inter_resStr, _vm->_global->_inter_variables + strVar); WRITE_VAR_OFFSET(resVar, pos - 1); } @@ -771,7 +771,7 @@ void Inter::istrlen(void) { int16 var; var = _vm->_parse->parseVarIndex(); - len = strlen(_vm->_global->inter_variables + var); + len = strlen(_vm->_global->_inter_variables + var); var = _vm->_parse->parseVarIndex(); WRITE_VAR_OFFSET(var, len); @@ -784,7 +784,7 @@ void Inter::strToLong(void) { int32 res; strVar = _vm->_parse->parseVarIndex(); - strcpy(str, _vm->_global->inter_variables + strVar); + strcpy(str, _vm->_global->_inter_variables + strVar); res = atol(str); destVar = _vm->_parse->parseVarIndex(); @@ -871,9 +871,9 @@ void Inter::createSprite(void) { flag = load16(); if (flag == 1) - _vm->_draw->spritesArray[index] = _vm->_video->initSurfDesc(_vm->_global->videoMode, width, height, 2); + _vm->_draw->spritesArray[index] = _vm->_video->initSurfDesc(_vm->_global->_videoMode, width, height, 2); else - _vm->_draw->spritesArray[index] = _vm->_video->initSurfDesc(_vm->_global->videoMode, width, height, 0); + _vm->_draw->spritesArray[index] = _vm->_video->initSurfDesc(_vm->_global->_videoMode, width, height, 0); _vm->_video->clearSurf(_vm->_draw->spritesArray[index]); } @@ -939,7 +939,7 @@ void Inter::playSound(void) { return; if (repCount < 0) { - if (_vm->_global->soundFlags < 2) + if (_vm->_global->_soundFlags < 2) return; repCount = -repCount; @@ -969,7 +969,7 @@ void Inter::loadCursor(void) { int8 index; id = load16(); - index = *_vm->_global->inter_execPtr++; + index = *_vm->_global->_inter_execPtr++; itemPtr = &_vm->_game->totResourceTable->items[id]; offset = itemPtr->offset; @@ -1000,13 +1000,13 @@ void Inter::loadSpriteToPos(void) { _vm->_draw->destSpriteX = _vm->_parse->parseValExpr(); _vm->_draw->destSpriteY = _vm->_parse->parseValExpr(); - _vm->_draw->transparency = _vm->_global->inter_execPtr[0]; - _vm->_draw->destSurface = (_vm->_global->inter_execPtr[0] / 2) - 1; + _vm->_draw->transparency = _vm->_global->_inter_execPtr[0]; + _vm->_draw->destSurface = (_vm->_global->_inter_execPtr[0] / 2) - 1; if (_vm->_draw->destSurface < 0) _vm->_draw->destSurface = 101; _vm->_draw->transparency &= 1; - _vm->_global->inter_execPtr += 2; + _vm->_global->_inter_execPtr += 2; _vm->_draw->spriteOperation(DRAW_LOADSPRITE); } @@ -1016,14 +1016,14 @@ void Inter::loadTot(void) { int16 i; debug(4, "loadTot"); - if ((*_vm->_global->inter_execPtr & 0x80) != 0) { - _vm->_global->inter_execPtr++; + if ((*_vm->_global->_inter_execPtr & 0x80) != 0) { + _vm->_global->_inter_execPtr++; evalExpr(0); - strcpy(buf, _vm->_global->inter_resStr); + strcpy(buf, _vm->_global->_inter_resStr); } else { - size = *_vm->_global->inter_execPtr++; + size = *_vm->_global->_inter_execPtr++; for (i = 0; i < size; i++) - buf[i] = *_vm->_global->inter_execPtr++; + buf[i] = *_vm->_global->_inter_execPtr++; buf[size] = 0; } @@ -1036,10 +1036,10 @@ void Inter::loadTot(void) { void Inter::storeKey(int16 key) { WRITE_VAR(12, _vm->_util->getTimeKey() - _vm->_game->startTimeKey); - WRITE_VAR(2, _vm->_global->inter_mouseX); - WRITE_VAR(3, _vm->_global->inter_mouseY); + WRITE_VAR(2, _vm->_global->_inter_mouseX); + WRITE_VAR(3, _vm->_global->_inter_mouseY); WRITE_VAR(4, _vm->_game->mouseButtons); - WRITE_VAR(1, _vm->_snd->playingSound); + WRITE_VAR(1, _vm->_snd->_playingSound); if (key == 0x4800) key = 0x0b; @@ -1079,56 +1079,56 @@ void Inter::keyFunc(void) { key = 0; - if (_vm->_global->pressedKeys[0x48]) + if (_vm->_global->_pressedKeys[0x48]) key |= 1; - if (_vm->_global->pressedKeys[0x50]) + if (_vm->_global->_pressedKeys[0x50]) key |= 2; - if (_vm->_global->pressedKeys[0x4d]) + if (_vm->_global->_pressedKeys[0x4d]) key |= 4; - if (_vm->_global->pressedKeys[0x4b]) + if (_vm->_global->_pressedKeys[0x4b]) key |= 8; - if (_vm->_global->pressedKeys[0x1c]) + if (_vm->_global->_pressedKeys[0x1c]) key |= 0x10; - if (_vm->_global->pressedKeys[0x39]) + if (_vm->_global->_pressedKeys[0x39]) key |= 0x20; - if (_vm->_global->pressedKeys[1]) + if (_vm->_global->_pressedKeys[1]) key |= 0x40; - if (_vm->_global->pressedKeys[0x1d]) + if (_vm->_global->_pressedKeys[0x1d]) key |= 0x80; - if (_vm->_global->pressedKeys[0x2a]) + if (_vm->_global->_pressedKeys[0x2a]) key |= 0x100; - if (_vm->_global->pressedKeys[0x36]) + if (_vm->_global->_pressedKeys[0x36]) key |= 0x200; - if (_vm->_global->pressedKeys[0x38]) + if (_vm->_global->_pressedKeys[0x38]) key |= 0x400; - if (_vm->_global->pressedKeys[0x3b]) + if (_vm->_global->_pressedKeys[0x3b]) key |= 0x800; - if (_vm->_global->pressedKeys[0x3c]) + if (_vm->_global->_pressedKeys[0x3c]) key |= 0x1000; - if (_vm->_global->pressedKeys[0x3d]) + if (_vm->_global->_pressedKeys[0x3d]) key |= 0x2000; - if (_vm->_global->pressedKeys[0x3e]) + if (_vm->_global->_pressedKeys[0x3e]) key |= 0x4000; WRITE_VAR(0, key); _vm->_util->waitKey(); return; } - key = _vm->_game->checkKeys(&_vm->_global->inter_mouseX, &_vm->_global->inter_mouseY, &_vm->_game->mouseButtons, 0); + key = _vm->_game->checkKeys(&_vm->_global->_inter_mouseX, &_vm->_global->_inter_mouseY, &_vm->_game->mouseButtons, 0); storeKey(key); return; @@ -1158,7 +1158,7 @@ void Inter::checkSwitchTable(char **ppExec) { value = VAR_OFFSET(value); do { - len = *(int8*)_vm->_global->inter_execPtr++; // must be a signed char typ and char is not default signed on all platforms. + len = *(int8*)_vm->_global->_inter_execPtr++; // must be a signed char typ and char is not default signed on all platforms. if (len == -5) break; @@ -1169,32 +1169,32 @@ void Inter::checkSwitchTable(char **ppExec) { if (_terminate) return; - if (_vm->_global->inter_resVal == value) { + if (_vm->_global->_inter_resVal == value) { found = 1; notFound = 0; } } if (found != 0) - *ppExec = _vm->_global->inter_execPtr; + *ppExec = _vm->_global->_inter_execPtr; - _vm->_global->inter_execPtr += READ_LE_UINT16(_vm->_global->inter_execPtr + 2) + 2; + _vm->_global->_inter_execPtr += READ_LE_UINT16(_vm->_global->_inter_execPtr + 2) + 2; found = 0; } while (len != -5); if (len != -5) - _vm->_global->inter_execPtr++; + _vm->_global->_inter_execPtr++; - defFlag = *_vm->_global->inter_execPtr; + defFlag = *_vm->_global->_inter_execPtr; defFlag >>= 4; if (defFlag != 4) return; - _vm->_global->inter_execPtr++; + _vm->_global->_inter_execPtr++; if (notFound) - *ppExec = _vm->_global->inter_execPtr; + *ppExec = _vm->_global->_inter_execPtr; - _vm->_global->inter_execPtr += READ_LE_UINT16(_vm->_global->inter_execPtr + 2) + 2; + _vm->_global->_inter_execPtr += READ_LE_UINT16(_vm->_global->_inter_execPtr + 2) + 2; } void Inter::repeatUntil(void) { @@ -1204,14 +1204,14 @@ void Inter::repeatUntil(void) { debug(4, "repeatUntil"); _nestLevel[0]++; - blockPtr = _vm->_global->inter_execPtr; + blockPtr = _vm->_global->_inter_execPtr; do { - _vm->_global->inter_execPtr = blockPtr; - size = READ_LE_UINT16(_vm->_global->inter_execPtr + 2) + 2; + _vm->_global->_inter_execPtr = blockPtr; + size = READ_LE_UINT16(_vm->_global->_inter_execPtr + 2) + 2; funcBlock(1); - _vm->_global->inter_execPtr = blockPtr + size + 1; + _vm->_global->_inter_execPtr = blockPtr + size + 1; flag = evalBoolResult(); } while (flag == 0 && !_breakFlag && !_terminate); @@ -1232,26 +1232,26 @@ void Inter::whileDo(void) { debug(4, "whileDo"); _nestLevel[0]++; do { - savedIP = _vm->_global->inter_execPtr; + savedIP = _vm->_global->_inter_execPtr; flag = evalBoolResult(); if (_terminate) return; - blockPtr = _vm->_global->inter_execPtr; + blockPtr = _vm->_global->_inter_execPtr; - size = READ_LE_UINT16(_vm->_global->inter_execPtr + 2) + 2; + size = READ_LE_UINT16(_vm->_global->_inter_execPtr + 2) + 2; if (flag != 0) { funcBlock(1); - _vm->_global->inter_execPtr = savedIP; + _vm->_global->_inter_execPtr = savedIP; } else { - _vm->_global->inter_execPtr += size; + _vm->_global->_inter_execPtr += size; } if (_breakFlag || _terminate) { - _vm->_global->inter_execPtr = blockPtr; - _vm->_global->inter_execPtr += size; + _vm->_global->_inter_execPtr = blockPtr; + _vm->_global->_inter_execPtr += size; break; } } while (flag != 0); @@ -1272,16 +1272,16 @@ void Inter::funcBlock(int16 retFlag) { char *callAddr; char boolRes; - if (_vm->_global->inter_execPtr == 0) + if (_vm->_global->_inter_execPtr == 0) return; _breakFlag = false; - _vm->_global->inter_execPtr++; - cmdCount = *_vm->_global->inter_execPtr++; - _vm->_global->inter_execPtr += 2; + _vm->_global->_inter_execPtr++; + cmdCount = *_vm->_global->_inter_execPtr++; + _vm->_global->_inter_execPtr += 2; if (cmdCount == 0) { - _vm->_global->inter_execPtr = 0; + _vm->_global->_inter_execPtr = 0; return; } @@ -1290,14 +1290,14 @@ void Inter::funcBlock(int16 retFlag) { if (_terminate) break; - cmd = (byte)*_vm->_global->inter_execPtr; + cmd = (byte)*_vm->_global->_inter_execPtr; if ((cmd >> 4) >= 12) { cmd2 = 16 - (cmd >> 4); cmd &= 0xf; } else cmd2 = 0; - _vm->_global->inter_execPtr++; + _vm->_global->_inter_execPtr++; counter++; debug(4, "funcBlock(%d, %d)", cmd2, cmd); @@ -1307,14 +1307,14 @@ void Inter::funcBlock(int16 retFlag) { switch (cmd >> 4) { case 0: case 1: - storedIP = _vm->_global->inter_execPtr; - _vm->_global->inter_execPtr = (char *)_vm->_game->totFileData + READ_LE_UINT16(_vm->_global->inter_execPtr); + storedIP = _vm->_global->_inter_execPtr; + _vm->_global->_inter_execPtr = (char *)_vm->_game->totFileData + READ_LE_UINT16(_vm->_global->_inter_execPtr); if (counter == cmdCount && retFlag == 2) return; callSub(2); - _vm->_global->inter_execPtr = storedIP + 2; + _vm->_global->_inter_execPtr = storedIP + 2; break; case 2: @@ -1327,14 +1327,14 @@ void Inter::funcBlock(int16 retFlag) { case 5: checkSwitchTable(&callAddr); - storedIP = _vm->_global->inter_execPtr; - _vm->_global->inter_execPtr = callAddr; + storedIP = _vm->_global->_inter_execPtr; + _vm->_global->_inter_execPtr = callAddr; if (counter == cmdCount && retFlag == 2) return; funcBlock(0); - _vm->_global->inter_execPtr = storedIP; + _vm->_global->_inter_execPtr = storedIP; break; case 6: @@ -1352,35 +1352,35 @@ void Inter::funcBlock(int16 retFlag) { && retFlag == 2) return; - storedIP = _vm->_global->inter_execPtr; + storedIP = _vm->_global->_inter_execPtr; funcBlock(0); - _vm->_global->inter_execPtr = storedIP; + _vm->_global->_inter_execPtr = storedIP; - _vm->_global->inter_execPtr += READ_LE_UINT16(_vm->_global->inter_execPtr + 2) + 2; + _vm->_global->_inter_execPtr += READ_LE_UINT16(_vm->_global->_inter_execPtr + 2) + 2; - debug(5, "cmd = %d", (int16)*_vm->_global->inter_execPtr); - cmd = (byte)(*_vm->_global->inter_execPtr) >> 4; - _vm->_global->inter_execPtr++; + debug(5, "cmd = %d", (int16)*_vm->_global->_inter_execPtr); + cmd = (byte)(*_vm->_global->_inter_execPtr) >> 4; + _vm->_global->_inter_execPtr++; if (cmd != 12) break; - _vm->_global->inter_execPtr += READ_LE_UINT16(_vm->_global->inter_execPtr + 2) + 2; + _vm->_global->_inter_execPtr += READ_LE_UINT16(_vm->_global->_inter_execPtr + 2) + 2; } else { - _vm->_global->inter_execPtr += READ_LE_UINT16(_vm->_global->inter_execPtr + 2) + 2; + _vm->_global->_inter_execPtr += READ_LE_UINT16(_vm->_global->_inter_execPtr + 2) + 2; - debug(5, "cmd = %d", (int16)*_vm->_global->inter_execPtr); - cmd = (byte)(*_vm->_global->inter_execPtr) >> 4; - _vm->_global->inter_execPtr++; + debug(5, "cmd = %d", (int16)*_vm->_global->_inter_execPtr); + cmd = (byte)(*_vm->_global->_inter_execPtr) >> 4; + _vm->_global->_inter_execPtr++; if (cmd != 12) break; if (counter == cmdCount && retFlag == 2) return; - 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; + _vm->_global->_inter_execPtr = storedIP; + _vm->_global->_inter_execPtr += READ_LE_UINT16(_vm->_global->_inter_execPtr + 2) + 2; } break; @@ -1429,7 +1429,7 @@ void Inter::funcBlock(int16 retFlag) { break; case 15: - cmdCount = *_vm->_global->inter_execPtr++; + cmdCount = *_vm->_global->_inter_execPtr++; counter = 0; break; } @@ -1442,7 +1442,7 @@ void Inter::funcBlock(int16 retFlag) { if (retFlag != 2) _breakFlag = true; - _vm->_global->inter_execPtr = 0; + _vm->_global->_inter_execPtr = 0; return; case 1: @@ -1480,7 +1480,7 @@ void Inter::funcBlock(int16 retFlag) { case 0: if (retFlag == 1) { _breakFlag = true; - _vm->_global->inter_execPtr = 0; + _vm->_global->_inter_execPtr = 0; return; } @@ -1489,7 +1489,7 @@ void Inter::funcBlock(int16 retFlag) { *_breakFromLevel = *_nestLevel; _breakFlag = true; - _vm->_global->inter_execPtr = 0; + _vm->_global->_inter_execPtr = 0; return; case 1: @@ -1590,8 +1590,8 @@ void Inter::funcBlock(int16 retFlag) { _vm->_draw->blitInvalidated(); _vm->_util->waitEndFrame(); animPalette(); - storeKey(_vm->_game->checkKeys(&_vm->_global->inter_mouseX, - &_vm->_global->inter_mouseY, &_vm->_game->mouseButtons, 0)); + storeKey(_vm->_game->checkKeys(&_vm->_global->_inter_mouseX, + &_vm->_global->_inter_mouseY, &_vm->_game->mouseButtons, 0)); break; case 9: @@ -1636,7 +1636,7 @@ void Inter::funcBlock(int16 retFlag) { } } while (counter != cmdCount); - _vm->_global->inter_execPtr = 0; + _vm->_global->_inter_execPtr = 0; return; } @@ -1654,8 +1654,8 @@ void Inter::initControlVars(void) { void Inter::callSub(int16 retFlag) { int16 block; - while (_vm->_global->inter_execPtr != 0 && (char *)_vm->_global->inter_execPtr != _vm->_game->totFileData) { - block = *_vm->_global->inter_execPtr; + while (_vm->_global->_inter_execPtr != 0 && (char *)_vm->_global->_inter_execPtr != _vm->_game->totFileData) { + block = *_vm->_global->_inter_execPtr; if (block == 1) { funcBlock(retFlag); } else if (block == 2) { @@ -1663,7 +1663,7 @@ void Inter::callSub(int16 retFlag) { } } - if ((char *)_vm->_global->inter_execPtr == _vm->_game->totFileData) + if ((char *)_vm->_global->_inter_execPtr == _vm->_game->totFileData) _terminate = true; } diff --git a/gob/mult.cpp b/gob/mult.cpp index e9ff27a20d..d9d1ae8861 100644 --- a/gob/mult.cpp +++ b/gob/mult.cpp @@ -441,11 +441,11 @@ void Mult::interInitMult(void) { objects = (Mult_Object *)malloc(sizeof(Mult_Object) * objCount); for (i = 0; i < objCount; i++) { - objects[i].pPosX = (int32 *)(_vm->_global->inter_variables + i * 4 + (posXVar / 4) * 4); - objects[i].pPosY = (int32 *)(_vm->_global->inter_variables + i * 4 + (posYVar / 4) * 4); + objects[i].pPosX = (int32 *)(_vm->_global->_inter_variables + i * 4 + (posXVar / 4) * 4); + objects[i].pPosY = (int32 *)(_vm->_global->_inter_variables + i * 4 + (posYVar / 4) * 4); objects[i].pAnimData = - (Mult_AnimData *) (_vm->_global->inter_variables + animDataVar + - i * 4 * _vm->_global->inter_animDataSize); + (Mult_AnimData *) (_vm->_global->_inter_variables + animDataVar + + i * 4 * _vm->_global->_inter_animDataSize); objects[i].pAnimData->isStatic = 1; objects[i].tick = 0; @@ -467,7 +467,7 @@ void Mult::interInitMult(void) { } if (_vm->_anim->_animSurf == 0) { - _vm->_anim->_animSurf = _vm->_video->initSurfDesc(_vm->_global->videoMode, + _vm->_anim->_animSurf = _vm->_video->initSurfDesc(_vm->_global->_videoMode, _vm->_anim->_areaWidth, _vm->_anim->_areaHeight, 0); _vm->_draw->spritesArray[22] = _vm->_anim->_animSurf; @@ -480,7 +480,7 @@ void Mult::interInitMult(void) { debug(4, "interInitMult: x = %d, y = %d, w = %d, h = %d", _vm->_anim->_areaLeft, _vm->_anim->_areaTop, _vm->_anim->_areaWidth, _vm->_anim->_areaHeight); - debug(4, " objCount = %d, animation data size = %d", objCount, _vm->_global->inter_animDataSize); + debug(4, " objCount = %d, animation data size = %d", objCount, _vm->_global->_inter_animDataSize); } void Mult::freeMult(void) { @@ -511,11 +511,11 @@ void Mult::interLoadMult(void) { lmultData = (char *)objects[objIndex].pAnimData; for (i = 0; i < 11; i++) { - if ((char)READ_LE_UINT16(_vm->_global->inter_execPtr) == (char)99) { + if ((char)READ_LE_UINT16(_vm->_global->_inter_execPtr) == (char)99) { _vm->_inter->evalExpr(&val); lmultData[i] = val; } else { - _vm->_global->inter_execPtr++; + _vm->_global->_inter_execPtr++; } } } @@ -642,9 +642,9 @@ void Mult::drawText(char *pStop, char *pStopNoClear) { frameStart = 0; } else if (cmd == 3) { *pStop = 0; - savedIP = _vm->_global->inter_execPtr; - _vm->_global->inter_execPtr = (char *)(&textKeys[index].index); - _vm->_global->inter_execPtr = savedIP; + savedIP = _vm->_global->_inter_execPtr; + _vm->_global->_inter_execPtr = (char *)(&textKeys[index].index); + _vm->_global->_inter_execPtr = savedIP; } } } @@ -660,11 +660,11 @@ char Mult::prepPalAnim(char stop) { if (palKeys[palKeyIndex].cmd == -1) { stop = 0; doPalSubst = 0; - _vm->_global->pPaletteDesc->vgaPal = oldPalette; + _vm->_global->_pPaletteDesc->vgaPal = oldPalette; - memcpy((char *)palAnimPalette, (char *)_vm->_global->pPaletteDesc->vgaPal, 768); + memcpy((char *)palAnimPalette, (char *)_vm->_global->_pPaletteDesc->vgaPal, 768); - _vm->_video->setFullPalette(_vm->_global->pPaletteDesc); + _vm->_video->setFullPalette(_vm->_global->_pPaletteDesc); } else { stop = 0; doPalSubst = 1; @@ -675,7 +675,7 @@ char Mult::prepPalAnim(char stop) { palAnimIndices[2] = 0; palAnimIndices[3] = 0; - _vm->_global->pPaletteDesc->vgaPal = palAnimPalette; + _vm->_global->_pPaletteDesc->vgaPal = palAnimPalette; } return stop; } @@ -696,27 +696,27 @@ void Mult::doPalAnim(void) { continue; palAnimRed[index] = - _vm->_global->pPaletteDesc->vgaPal[palKey->subst[0][index] - 1].red; + _vm->_global->_pPaletteDesc->vgaPal[palKey->subst[0][index] - 1].red; palAnimGreen[index] = - _vm->_global->pPaletteDesc->vgaPal[palKey->subst[0][index] - 1].green; + _vm->_global->_pPaletteDesc->vgaPal[palKey->subst[0][index] - 1].green; palAnimBlue[index] = - _vm->_global->pPaletteDesc->vgaPal[palKey->subst[0][index] - 1].blue; + _vm->_global->_pPaletteDesc->vgaPal[palKey->subst[0][index] - 1].blue; while (1) { off = palKey->subst[(palAnimIndices[index] + 1) % 16][index]; if (off == 0) { off = palKey->subst[palAnimIndices[index]][index] - 1; - _vm->_global->pPaletteDesc->vgaPal[off].red = palAnimRed[index]; - _vm->_global->pPaletteDesc->vgaPal[off].green = palAnimGreen[index]; - _vm->_global->pPaletteDesc->vgaPal[off].blue = palAnimBlue[index]; + _vm->_global->_pPaletteDesc->vgaPal[off].red = palAnimRed[index]; + _vm->_global->_pPaletteDesc->vgaPal[off].green = palAnimGreen[index]; + _vm->_global->_pPaletteDesc->vgaPal[off].blue = palAnimBlue[index]; } else { off = palKey->subst[(palAnimIndices[index] + 1) % 16][index] - 1; off2 = palKey->subst[palAnimIndices[index]][index] - 1; - _vm->_global->pPaletteDesc->vgaPal[off2].red = _vm->_global->pPaletteDesc->vgaPal[off].red; - _vm->_global->pPaletteDesc->vgaPal[off2].green = _vm->_global->pPaletteDesc->vgaPal[off].green; - _vm->_global->pPaletteDesc->vgaPal[off2].blue = _vm->_global->pPaletteDesc->vgaPal[off].blue; + _vm->_global->_pPaletteDesc->vgaPal[off2].red = _vm->_global->_pPaletteDesc->vgaPal[off].red; + _vm->_global->_pPaletteDesc->vgaPal[off2].green = _vm->_global->_pPaletteDesc->vgaPal[off].green; + _vm->_global->_pPaletteDesc->vgaPal[off2].blue = _vm->_global->_pPaletteDesc->vgaPal[off].blue; } palAnimIndices[index] = (palAnimIndices[index] + 1) % 16; @@ -727,33 +727,33 @@ void Mult::doPalAnim(void) { palAnimIndices[index] = 0; off = palKey->subst[0][index] - 1; - palAnimRed[index] = _vm->_global->pPaletteDesc->vgaPal[off].red; - palAnimGreen[index] = _vm->_global->pPaletteDesc->vgaPal[off].green; - palAnimBlue[index] = _vm->_global->pPaletteDesc->vgaPal[off].blue; + palAnimRed[index] = _vm->_global->_pPaletteDesc->vgaPal[off].red; + palAnimGreen[index] = _vm->_global->_pPaletteDesc->vgaPal[off].green; + palAnimBlue[index] = _vm->_global->_pPaletteDesc->vgaPal[off].blue; } if (palAnimIndices[index] == 0) break; } } - if (_vm->_global->colorCount == 256) { - _vm->_video->waitRetrace(_vm->_global->videoMode); + if (_vm->_global->_colorCount == 256) { + _vm->_video->waitRetrace(_vm->_global->_videoMode); - palPtr = _vm->_global->pPaletteDesc->vgaPal; + palPtr = _vm->_global->_pPaletteDesc->vgaPal; for (counter = 0; counter < 16; counter++) { _vm->_video->setPalElem(counter, palPtr->red, palPtr->green, palPtr->blue, 0, 0x13); palPtr++; } - palPtr = _vm->_global->pPaletteDesc->vgaPal; + palPtr = _vm->_global->_pPaletteDesc->vgaPal; for (counter = 0; counter < 16; counter++) { - _vm->_global->redPalette[counter] = palPtr->red; - _vm->_global->greenPalette[counter] = palPtr->green; - _vm->_global->bluePalette[counter] = palPtr->blue; + _vm->_global->_redPalette[counter] = palPtr->red; + _vm->_global->_greenPalette[counter] = palPtr->green; + _vm->_global->_bluePalette[counter] = palPtr->blue; palPtr++; } } else { - _vm->_video->setFullPalette(_vm->_global->pPaletteDesc); + _vm->_video->setFullPalette(_vm->_global->_pPaletteDesc); } } @@ -769,15 +769,15 @@ char Mult::doFadeAnim(char stop) { stop = 0; if ((fadeKey->flag & 1) == 0) { if (fadeKey->fade == 0) { - _vm->_global->pPaletteDesc->vgaPal = fadePal[fadeKey->palIndex]; - _vm->_video->setFullPalette(_vm->_global->pPaletteDesc); + _vm->_global->_pPaletteDesc->vgaPal = fadePal[fadeKey->palIndex]; + _vm->_video->setFullPalette(_vm->_global->_pPaletteDesc); } else { - _vm->_global->pPaletteDesc->vgaPal = fadePal[fadeKey->palIndex]; - _vm->_palanim->fade(_vm->_global->pPaletteDesc, fadeKey->fade, 0); + _vm->_global->_pPaletteDesc->vgaPal = fadePal[fadeKey->palIndex]; + _vm->_palanim->fade(_vm->_global->_pPaletteDesc, fadeKey->fade, 0); } } else { - _vm->_global->pPaletteDesc->vgaPal = fadePal[fadeKey->palIndex]; - _vm->_palanim->fade(_vm->_global->pPaletteDesc, fadeKey->fade, -1); + _vm->_global->_pPaletteDesc->vgaPal = fadePal[fadeKey->palIndex]; + _vm->_palanim->fade(_vm->_global->_pPaletteDesc, fadeKey->fade, -1); palFadingRed = (fadeKey->flag >> 1) & 1; palFadingGreen = (fadeKey->flag >> 2) & 1; @@ -821,7 +821,7 @@ char Mult::doSoundAnim(char stop) { sndKey->freq, sndKey->channel); } } else { - if (_vm->_snd->playingSound) + if (_vm->_snd->_playingSound) _vm->_snd->stopSound(sndKey->channel); } } @@ -849,8 +849,8 @@ void Mult::playMult(int16 startFrame, int16 endFrame, char checkEscape, palFadingGreen = 0; palFadingBlue = 0; - oldPalette = _vm->_global->pPaletteDesc->vgaPal; - memcpy((char *)palAnimPalette, (char *)_vm->_global->pPaletteDesc->vgaPal, 768); + oldPalette = _vm->_global->_pPaletteDesc->vgaPal; + memcpy((char *)palAnimPalette, (char *)_vm->_global->_pPaletteDesc->vgaPal, 768); if (_vm->_anim->_animSurf == 0) { _vm->_util->setFrameRate(frameRate); @@ -887,7 +887,7 @@ void Mult::playMult(int16 startFrame, int16 endFrame, char checkEscape, } _vm->_anim->_animSurf = - _vm->_video->initSurfDesc(_vm->_global->videoMode, 320, 200, 0); + _vm->_video->initSurfDesc(_vm->_global->_videoMode, 320, 200, 0); _vm->_draw->spritesArray[22] = _vm->_anim->_animSurf; _vm->_video->drawSprite(_vm->_draw->backSurface, _vm->_anim->_animSurf, @@ -927,7 +927,7 @@ void Mult::playMult(int16 startFrame, int16 endFrame, char checkEscape, if (frame >= endFrame) stopNoClear = 1; - if (_vm->_snd->playingSound) + if (_vm->_snd->_playingSound) stop = 0; _vm->_util->processInput(); @@ -962,7 +962,7 @@ void Mult::playMult(int16 startFrame, int16 endFrame, char checkEscape, animDataAllocated = 0; } - if (_vm->_snd->playingSound != 0) + if (_vm->_snd->_playingSound != 0) _vm->_snd->stopSound(10); WRITE_VAR(57, (uint32)-1); @@ -1110,14 +1110,14 @@ void Mult::loadMult(int16 resId) { switch (sndKeys[i].cmd) { case 1: case 4: - sndKeys[i].resId = READ_LE_UINT16(_vm->_global->inter_execPtr); + sndKeys[i].resId = READ_LE_UINT16(_vm->_global->_inter_execPtr); for (j = 0; j < i; j++) { if (sndKeys[i].resId == sndKeys[j].resId) { sndKeys[i].soundIndex = sndKeys[j].soundIndex; - _vm->_global->inter_execPtr += 2; + _vm->_global->_inter_execPtr += 2; break; } } @@ -1130,11 +1130,11 @@ void Mult::loadMult(int16 resId) { break; case 3: - _vm->_global->inter_execPtr += 6; + _vm->_global->_inter_execPtr += 6; break; case 5: - _vm->_global->inter_execPtr += sndKeys[i].freq * 2; + _vm->_global->_inter_execPtr += sndKeys[i].freq * 2; break; } } diff --git a/gob/palanim.cpp b/gob/palanim.cpp index 268d260b3b..d088ff62a7 100644 --- a/gob/palanim.cpp +++ b/gob/palanim.cpp @@ -52,29 +52,29 @@ char PalAnim::fadeStep(int16 oper) { char stop; int16 i; - if (_vm->_global->colorCount != 256) + if (_vm->_global->_colorCount != 256) error("fadeStep: Only 256 color mode is supported!"); if (oper == 0) { stop = 1; - if (_vm->_global->setAllPalette) { - if (_vm->_global->inVM != 0) - error("fade: _vm->_global->inVM != 0 not supported."); + if (_vm->_global->_setAllPalette) { + if (_vm->_global->_inVM != 0) + error("fade: _vm->_global->_inVM != 0 not supported."); for (i = 0; i < 256; i++) { - newRed = fadeColor(_vm->_global->redPalette[i], _toFadeRed[i]); - newGreen = fadeColor(_vm->_global->greenPalette[i], _toFadeGreen[i]); - newBlue = fadeColor(_vm->_global->bluePalette[i], _toFadeBlue[i]); + newRed = fadeColor(_vm->_global->_redPalette[i], _toFadeRed[i]); + newGreen = fadeColor(_vm->_global->_greenPalette[i], _toFadeGreen[i]); + newBlue = fadeColor(_vm->_global->_bluePalette[i], _toFadeBlue[i]); - if (_vm->_global->redPalette[i] != newRed - || _vm->_global->greenPalette[i] != newGreen - || _vm->_global->bluePalette[i] != newBlue) { + if (_vm->_global->_redPalette[i] != newRed + || _vm->_global->_greenPalette[i] != newGreen + || _vm->_global->_bluePalette[i] != newBlue) { _vm->_video->setPalElem(i, newRed, newGreen, newBlue, 0, 0x13); - _vm->_global->redPalette[i] = newRed; - _vm->_global->greenPalette[i] = newGreen; - _vm->_global->bluePalette[i] = newBlue; + _vm->_global->_redPalette[i] = newRed; + _vm->_global->_greenPalette[i] = newGreen; + _vm->_global->_bluePalette[i] = newBlue; stop = 0; } } @@ -82,16 +82,16 @@ char PalAnim::fadeStep(int16 oper) { for (i = 0; i < 16; i++) { _vm->_video->setPalElem(i, - fadeColor(_vm->_global->redPalette[i], + fadeColor(_vm->_global->_redPalette[i], _toFadeRed[i]), - fadeColor(_vm->_global->greenPalette[i], + fadeColor(_vm->_global->_greenPalette[i], _toFadeGreen[i]), - fadeColor(_vm->_global->bluePalette[i], - _toFadeBlue[i]), -1, _vm->_global->videoMode); + fadeColor(_vm->_global->_bluePalette[i], + _toFadeBlue[i]), -1, _vm->_global->_videoMode); - if (_vm->_global->redPalette[i] != _toFadeRed[i] || - _vm->_global->greenPalette[i] != _toFadeGreen[i] || - _vm->_global->bluePalette[i] != _toFadeBlue[i]) + if (_vm->_global->_redPalette[i] != _toFadeRed[i] || + _vm->_global->_greenPalette[i] != _toFadeGreen[i] || + _vm->_global->_bluePalette[i] != _toFadeBlue[i]) stop = 0; } } @@ -100,10 +100,10 @@ char PalAnim::fadeStep(int16 oper) { stop = 1; for (i = 0; i < 16; i++) { _vm->_video->setPalElem(i, - fadeColor(_vm->_global->redPalette[i], _toFadeRed[i]), - _vm->_global->greenPalette[i], _vm->_global->bluePalette[i], -1, _vm->_global->videoMode); + fadeColor(_vm->_global->_redPalette[i], _toFadeRed[i]), + _vm->_global->_greenPalette[i], _vm->_global->_bluePalette[i], -1, _vm->_global->_videoMode); - if (_vm->_global->redPalette[i] != _toFadeRed[i]) + if (_vm->_global->_redPalette[i] != _toFadeRed[i]) stop = 0; } return stop; @@ -111,11 +111,11 @@ char PalAnim::fadeStep(int16 oper) { stop = 1; for (i = 0; i < 16; i++) { _vm->_video->setPalElem(i, - _vm->_global->redPalette[i], - fadeColor(_vm->_global->greenPalette[i], _toFadeGreen[i]), - _vm->_global->bluePalette[i], -1, _vm->_global->videoMode); + _vm->_global->_redPalette[i], + fadeColor(_vm->_global->_greenPalette[i], _toFadeGreen[i]), + _vm->_global->_bluePalette[i], -1, _vm->_global->_videoMode); - if (_vm->_global->greenPalette[i] != _toFadeGreen[i]) + if (_vm->_global->_greenPalette[i] != _toFadeGreen[i]) stop = 0; } return stop; @@ -123,12 +123,12 @@ char PalAnim::fadeStep(int16 oper) { stop = 1; for (i = 0; i < 16; i++) { _vm->_video->setPalElem(i, - _vm->_global->redPalette[i], - _vm->_global->greenPalette[i], - fadeColor(_vm->_global->bluePalette[i], _toFadeBlue[i]), - -1, _vm->_global->videoMode); + _vm->_global->_redPalette[i], + _vm->_global->_greenPalette[i], + fadeColor(_vm->_global->_bluePalette[i], _toFadeBlue[i]), + -1, _vm->_global->_videoMode); - if (_vm->_global->bluePalette[i] != _toFadeBlue[i]) + if (_vm->_global->_bluePalette[i] != _toFadeBlue[i]) stop = 0; } return stop; @@ -145,13 +145,13 @@ void PalAnim::fade(Video::PalDesc *palDesc, int16 fadeV, int16 allColors) { else _fadeValue = 2; - if (_vm->_global->colorCount < 256) { + if (_vm->_global->_colorCount < 256) { if (palDesc != 0) _vm->_video->setFullPalette(palDesc); return; } - if (_vm->_global->setAllPalette == 0) { + if (_vm->_global->_setAllPalette == 0) { if (palDesc == 0) { for (i = 0; i < 16; i++) { _toFadeRed[i] = 0; @@ -166,8 +166,8 @@ void PalAnim::fade(Video::PalDesc *palDesc, int16 fadeV, int16 allColors) { } } } else { - if (_vm->_global->inVM != 0) - error("fade: _vm->_global->inVM != 0 is not supported"); + if (_vm->_global->_inVM != 0) + error("fade: _vm->_global->_inVM != 0 is not supported"); if (palDesc == 0) { for (i = 0; i < 256; i++) { @@ -186,8 +186,8 @@ void PalAnim::fade(Video::PalDesc *palDesc, int16 fadeV, int16 allColors) { if (allColors == 0) { do { - if (_vm->_global->tmpPalBuffer == 0) - _vm->_video->waitRetrace(_vm->_global->videoMode); + if (_vm->_global->_tmpPalBuffer == 0) + _vm->_video->waitRetrace(_vm->_global->_videoMode); stop = fadeStep(0); @@ -203,17 +203,17 @@ void PalAnim::fade(Video::PalDesc *palDesc, int16 fadeV, int16 allColors) { if (allColors == 1) { do { - _vm->_video->waitRetrace(_vm->_global->videoMode); + _vm->_video->waitRetrace(_vm->_global->_videoMode); stop = fadeStep(1); } while (stop == 0); do { - _vm->_video->waitRetrace(_vm->_global->videoMode); + _vm->_video->waitRetrace(_vm->_global->_videoMode); stop = fadeStep(2); } while (stop == 0); do { - _vm->_video->waitRetrace(_vm->_global->videoMode); + _vm->_video->waitRetrace(_vm->_global->_videoMode); stop = fadeStep(3); } while (stop == 0); @@ -223,8 +223,8 @@ void PalAnim::fade(Video::PalDesc *palDesc, int16 fadeV, int16 allColors) { _vm->_util->clearPalette(); } - free(_vm->_global->tmpPalBuffer); - _vm->_global->tmpPalBuffer = 0; + free(_vm->_global->_tmpPalBuffer); + _vm->_global->_tmpPalBuffer = 0; } } // End of namespace Gob diff --git a/gob/parse.cpp b/gob/parse.cpp index 9d7134a4a1..ac3884510d 100644 --- a/gob/parse.cpp +++ b/gob/parse.cpp @@ -39,10 +39,10 @@ int32 Parse::encodePtr(char *ptr, int type) { offset = ptr - _vm->_game->totFileData; break; case kInterVar: - offset = ptr - _vm->_global->inter_variables; + offset = ptr - _vm->_global->_inter_variables; break; case kResStr: - offset = ptr - _vm->_global->inter_resStr; + offset = ptr - _vm->_global->_inter_resStr; break; default: error("encodePtr: Unknown pointer type"); @@ -59,10 +59,10 @@ char *Parse::decodePtr(int32 n) { ptr = _vm->_game->totFileData; break; case kInterVar: - ptr = _vm->_global->inter_variables; + ptr = _vm->_global->_inter_variables; break; case kResStr: - ptr = _vm->_global->inter_resStr; + ptr = _vm->_global->_inter_resStr; break; default: error("decodePtr: Unknown pointer type"); @@ -98,13 +98,13 @@ int16 Parse::parseExpr(char arg_0, byte *arg_2) { stkPos++; operPtr++; valPtr++; - operation = *_vm->_global->inter_execPtr++; + operation = *_vm->_global->_inter_execPtr++; if (operation >= 19 && operation <= 29) { switch (operation) { case 19: *operPtr = 20; - *valPtr = READ_LE_UINT32(_vm->_global->inter_execPtr); - _vm->_global->inter_execPtr += 4; + *valPtr = READ_LE_UINT32(_vm->_global->_inter_execPtr); + _vm->_global->_inter_execPtr += 4; break; case 20: @@ -114,8 +114,8 @@ int16 Parse::parseExpr(char arg_0, byte *arg_2) { case 22: *operPtr = 22; - *valPtr = encodePtr(_vm->_global->inter_execPtr, kExecPtr); - _vm->_global->inter_execPtr += strlen(_vm->_global->inter_execPtr) + 1; + *valPtr = encodePtr(_vm->_global->_inter_execPtr, kExecPtr); + _vm->_global->_inter_execPtr += strlen(_vm->_global->_inter_execPtr) + 1; break; case 23: @@ -126,12 +126,12 @@ int16 Parse::parseExpr(char arg_0, byte *arg_2) { case 25: *operPtr = 22; temp = _vm->_inter->load16() * 4; - *valPtr = encodePtr(_vm->_global->inter_variables + temp, kInterVar); - if (*_vm->_global->inter_execPtr == 13) { - _vm->_global->inter_execPtr++; + *valPtr = encodePtr(_vm->_global->_inter_variables + temp, kInterVar); + if (*_vm->_global->_inter_execPtr == 13) { + _vm->_global->_inter_execPtr++; temp += parseValExpr(); *operPtr = 20; - *valPtr = (uint8)*(_vm->_global->inter_variables + temp); + *valPtr = (uint8)*(_vm->_global->_inter_variables + temp); } break; @@ -139,9 +139,9 @@ int16 Parse::parseExpr(char arg_0, byte *arg_2) { case 28: *operPtr = operation - 6; temp = _vm->_inter->load16(); - dimCount = *_vm->_global->inter_execPtr++; - arrDescPtr = (byte *)_vm->_global->inter_execPtr; - _vm->_global->inter_execPtr += dimCount; + dimCount = *_vm->_global->_inter_execPtr++; + arrDescPtr = (byte *)_vm->_global->_inter_execPtr; + _vm->_global->_inter_execPtr += dimCount; offset = 0; dim = 0; for (dim = 0; dim < dimCount; dim++) { @@ -153,22 +153,22 @@ int16 Parse::parseExpr(char arg_0, byte *arg_2) { *valPtr = VAR(temp + offset); break; } - *valPtr = encodePtr(_vm->_global->inter_variables + temp * 4 + offset * _vm->_global->inter_animDataSize * 4, kInterVar); - if (*_vm->_global->inter_execPtr == 13) { - _vm->_global->inter_execPtr++; + *valPtr = encodePtr(_vm->_global->_inter_variables + temp * 4 + offset * _vm->_global->_inter_animDataSize * 4, kInterVar); + if (*_vm->_global->_inter_execPtr == 13) { + _vm->_global->_inter_execPtr++; temp2 = parseValExpr(); *operPtr = 20; - *valPtr = (uint8)*(_vm->_global->inter_variables + temp * 4 + offset * 4 * _vm->_global->inter_animDataSize + temp2); + *valPtr = (uint8)*(_vm->_global->_inter_variables + temp * 4 + offset * 4 * _vm->_global->_inter_animDataSize + temp2); } break; case 29: - operation = *_vm->_global->inter_execPtr++; + operation = *_vm->_global->_inter_execPtr++; parseExpr(10, 0); switch (operation) { case 5: - _vm->_global->inter_resVal = _vm->_global->inter_resVal * _vm->_global->inter_resVal; + _vm->_global->_inter_resVal = _vm->_global->_inter_resVal * _vm->_global->_inter_resVal; break; case 0: @@ -180,22 +180,22 @@ int16 Parse::parseExpr(char arg_0, byte *arg_2) { do { prevPrevVal = prevVal; prevVal = curVal; - curVal = (curVal + _vm->_global->inter_resVal / curVal) / 2; + curVal = (curVal + _vm->_global->_inter_resVal / curVal) / 2; } while (curVal != prevVal && curVal != prevPrevVal); - _vm->_global->inter_resVal = curVal; + _vm->_global->_inter_resVal = curVal; break; case 10: - _vm->_global->inter_resVal = _vm->_util->getRandom(_vm->_global->inter_resVal); + _vm->_global->_inter_resVal = _vm->_util->getRandom(_vm->_global->_inter_resVal); break; case 7: - if (_vm->_global->inter_resVal < 0) - _vm->_global->inter_resVal = -_vm->_global->inter_resVal; + if (_vm->_global->_inter_resVal < 0) + _vm->_global->_inter_resVal = -_vm->_global->_inter_resVal; break; } *operPtr = 20; - *valPtr = _vm->_global->inter_resVal; + *valPtr = _vm->_global->_inter_resVal; } if (stkPos > 0 && (operPtr[-1] == 1 || operPtr[-1] == 11)) { @@ -220,11 +220,11 @@ int16 Parse::parseExpr(char arg_0, 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 (decodePtr(valPtr[-2]) != _vm->_global->_inter_resStr) { + strcpy(_vm->_global->_inter_resStr, decodePtr(valPtr[-2])); + valPtr[-2] = encodePtr(_vm->_global->_inter_resStr, kResStr); } - strcat(_vm->_global->inter_resStr, decodePtr(valPtr[0])); + strcat(_vm->_global->_inter_resStr, decodePtr(valPtr[0])); stkPos -= 2; operPtr -= 2; valPtr -= 2; @@ -340,11 +340,11 @@ int16 Parse::parseExpr(char arg_0, 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])); - values[brackStart] = encodePtr(_vm->_global->inter_resStr, kResStr); + if (decodePtr(values[brackStart]) != _vm->_global->_inter_resStr) { + strcpy(_vm->_global->_inter_resStr, decodePtr(values[brackStart])); + values[brackStart] = encodePtr(_vm->_global->_inter_resStr, kResStr); } - strcat(_vm->_global->inter_resStr, decodePtr(valPtr[-1])); + strcat(_vm->_global->_inter_resStr, decodePtr(valPtr[-1])); } stkPos -= 2; operPtr -= 2; @@ -416,11 +416,11 @@ int16 Parse::parseExpr(char arg_0, 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 (decodePtr(valPtr[-3]) != _vm->_global->_inter_resStr) { + strcpy(_vm->_global->_inter_resStr, decodePtr(valPtr[-3])); + valPtr[-3] = encodePtr(_vm->_global->_inter_resStr, kResStr); } - if (strcmp(_vm->_global->inter_resStr, decodePtr(valPtr[-1])) < 0) + if (strcmp(_vm->_global->_inter_resStr, decodePtr(valPtr[-1])) < 0) operPtr[-3] = 24; } stkPos -= 2; @@ -435,11 +435,11 @@ int16 Parse::parseExpr(char arg_0, 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 (decodePtr(valPtr[-3]) != _vm->_global->_inter_resStr) { + strcpy(_vm->_global->_inter_resStr, decodePtr(valPtr[-3])); + valPtr[-3] = encodePtr(_vm->_global->_inter_resStr, kResStr); } - if (strcmp(_vm->_global->inter_resStr, decodePtr(valPtr[-1])) <= 0) + if (strcmp(_vm->_global->_inter_resStr, decodePtr(valPtr[-1])) <= 0) operPtr[-3] = 24; } stkPos -= 2; @@ -454,11 +454,11 @@ int16 Parse::parseExpr(char arg_0, 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 (decodePtr(valPtr[-3]) != _vm->_global->_inter_resStr) { + strcpy(_vm->_global->_inter_resStr, decodePtr(valPtr[-3])); + valPtr[-3] = encodePtr(_vm->_global->_inter_resStr, kResStr); } - if (strcmp(_vm->_global->inter_resStr, decodePtr(valPtr[-1])) > 0) + if (strcmp(_vm->_global->_inter_resStr, decodePtr(valPtr[-1])) > 0) operPtr[-3] = 24; } stkPos -= 2; @@ -473,11 +473,11 @@ int16 Parse::parseExpr(char arg_0, 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 (decodePtr(valPtr[-3]) != _vm->_global->_inter_resStr) { + strcpy(_vm->_global->_inter_resStr, decodePtr(valPtr[-3])); + valPtr[-3] = encodePtr(_vm->_global->_inter_resStr, kResStr); } - if (strcmp(_vm->_global->inter_resStr, decodePtr(valPtr[-1])) >= 0) + if (strcmp(_vm->_global->_inter_resStr, decodePtr(valPtr[-1])) >= 0) operPtr[-3] = 24; } stkPos -= 2; @@ -492,11 +492,11 @@ int16 Parse::parseExpr(char arg_0, 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 (decodePtr(valPtr[-3]) != _vm->_global->_inter_resStr) { + strcpy(_vm->_global->_inter_resStr, decodePtr(valPtr[-3])); + valPtr[-3] = encodePtr(_vm->_global->_inter_resStr, kResStr); } - if (strcmp(_vm->_global->inter_resStr, decodePtr(valPtr[-1])) == 0) + if (strcmp(_vm->_global->_inter_resStr, decodePtr(valPtr[-1])) == 0) operPtr[-3] = 24; } stkPos -= 2; @@ -511,11 +511,11 @@ int16 Parse::parseExpr(char arg_0, 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 (decodePtr(valPtr[-3]) != _vm->_global->_inter_resStr) { + strcpy(_vm->_global->_inter_resStr, decodePtr(valPtr[-3])); + valPtr[-3] = encodePtr(_vm->_global->_inter_resStr, kResStr); } - if (strcmp(_vm->_global->inter_resStr, decodePtr(valPtr[-1])) != 0) + if (strcmp(_vm->_global->_inter_resStr, decodePtr(valPtr[-1])) != 0) operPtr[-3] = 24; } stkPos -= 2; @@ -551,7 +551,7 @@ int16 Parse::parseExpr(char arg_0, byte *arg_2) { } else { skipExpr(arg_0); } - operation = _vm->_global->inter_execPtr[-1]; + operation = _vm->_global->_inter_execPtr[-1]; if (stkPos > 0 && operPtr[-1] == 11) { if (operPtr[0] == 23) operPtr[-1] = 24; @@ -578,12 +578,12 @@ int16 Parse::parseExpr(char arg_0, byte *arg_2) { switch (operStack[0]) { case 20: - _vm->_global->inter_resVal = values[0]; + _vm->_global->_inter_resVal = values[0]; break; case 22: - if (decodePtr(values[0]) != _vm->_global->inter_resStr) - strcpy(_vm->_global->inter_resStr, decodePtr(values[0])); + if (decodePtr(values[0]) != _vm->_global->_inter_resStr) + strcpy(_vm->_global->_inter_resStr, decodePtr(values[0])); break; case 11: @@ -596,7 +596,7 @@ int16 Parse::parseExpr(char arg_0, byte *arg_2) { break; default: - _vm->_global->inter_resVal = 0; + _vm->_global->_inter_resVal = 0; if (arg_2 != 0) *arg_2 = 20; break; @@ -613,11 +613,11 @@ int16 Parse::parseExpr(char arg_0, 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 (decodePtr(valPtr[-3]) != _vm->_global->_inter_resStr) { + strcpy(_vm->_global->_inter_resStr, decodePtr(valPtr[-3])); + valPtr[-3] = encodePtr(_vm->_global->_inter_resStr, kResStr); } - strcat(_vm->_global->inter_resStr, decodePtr(valPtr[-1])); + strcat(_vm->_global->_inter_resStr, decodePtr(valPtr[-1])); } stkPos -= 2; operPtr -= 2; @@ -648,46 +648,46 @@ void Parse::skipExpr(char arg_0) { num = 0; while (1) { - operation = *_vm->_global->inter_execPtr++; + operation = *_vm->_global->_inter_execPtr++; if (operation >= 19 && operation <= 29) { switch (operation) { case 20: case 23: - _vm->_global->inter_execPtr += 2; + _vm->_global->_inter_execPtr += 2; break; case 19: - _vm->_global->inter_execPtr += 4; + _vm->_global->_inter_execPtr += 4; break; case 22: - _vm->_global->inter_execPtr += strlen(_vm->_global->inter_execPtr) + 1; + _vm->_global->_inter_execPtr += strlen(_vm->_global->_inter_execPtr) + 1; break; case 25: - _vm->_global->inter_execPtr += 2; - if (*_vm->_global->inter_execPtr == 13) { - _vm->_global->inter_execPtr++; + _vm->_global->_inter_execPtr += 2; + if (*_vm->_global->_inter_execPtr == 13) { + _vm->_global->_inter_execPtr++; skipExpr(12); } break; case 26: case 28: - dimCount = _vm->_global->inter_execPtr[2]; - _vm->_global->inter_execPtr += 3 + dimCount; // ??? + dimCount = _vm->_global->_inter_execPtr[2]; + _vm->_global->_inter_execPtr += 3 + dimCount; // ??? for (dim = 0; dim < dimCount; dim++) skipExpr(12); - if (operation == 28 && *_vm->_global->inter_execPtr == 13) { - _vm->_global->inter_execPtr++; + if (operation == 28 && *_vm->_global->_inter_execPtr == 13) { + _vm->_global->_inter_execPtr++; skipExpr(12); } break; case 29: - _vm->_global->inter_execPtr++; + _vm->_global->_inter_execPtr++; skipExpr(10); } continue; @@ -747,13 +747,13 @@ int16 Parse::parseValExpr() { operPtr++; valPtr++; - operation = *_vm->_global->inter_execPtr++; + operation = *_vm->_global->_inter_execPtr++; if (operation >= 19 && operation <= 29) { *operPtr = 20; switch (operation) { case 19: - *valPtr = READ_LE_UINT32(_vm->_global->inter_execPtr); - _vm->_global->inter_execPtr += 4; + *valPtr = READ_LE_UINT32(_vm->_global->_inter_execPtr); + _vm->_global->_inter_execPtr += 4; break; case 20: @@ -766,17 +766,17 @@ int16 Parse::parseValExpr() { case 25: temp = _vm->_inter->load16() * 4; - _vm->_global->inter_execPtr++; + _vm->_global->_inter_execPtr++; temp += parseValExpr(); - *valPtr = (uint8)*(_vm->_global->inter_variables + temp); + *valPtr = (uint8)*(_vm->_global->_inter_variables + temp); break; case 26: case 28: temp = _vm->_inter->load16(); - dimCount = *_vm->_global->inter_execPtr++; - arrDesc = (byte*)_vm->_global->inter_execPtr; - _vm->_global->inter_execPtr += dimCount; + dimCount = *_vm->_global->_inter_execPtr++; + arrDesc = (byte*)_vm->_global->_inter_execPtr; + _vm->_global->_inter_execPtr += dimCount; offset = 0; for (dim = 0; dim < dimCount; dim++) { temp2 = parseValExpr(); @@ -785,25 +785,25 @@ int16 Parse::parseValExpr() { if (operation == 26) { *valPtr = (uint16)VAR(temp + offset); } else { - _vm->_global->inter_execPtr++; + _vm->_global->_inter_execPtr++; temp2 = parseValExpr(); - *valPtr = (uint8)*(_vm->_global->inter_variables + temp * 4 + offset * 4 * _vm->_global->inter_animDataSize + temp2); + *valPtr = (uint8)*(_vm->_global->_inter_variables + temp * 4 + offset * 4 * _vm->_global->_inter_animDataSize + temp2); } break; case 29: - operation = *_vm->_global->inter_execPtr++; + operation = *_vm->_global->_inter_execPtr++; parseExpr(10, 0); if (operation == 5) { - _vm->_global->inter_resVal = _vm->_global->inter_resVal * _vm->_global->inter_resVal; + _vm->_global->_inter_resVal = _vm->_global->_inter_resVal * _vm->_global->_inter_resVal; } else if (operation == 7) { - if (_vm->_global->inter_resVal < 0) - _vm->_global->inter_resVal = -_vm->_global->inter_resVal; + if (_vm->_global->_inter_resVal < 0) + _vm->_global->_inter_resVal = -_vm->_global->_inter_resVal; } else if (operation == 10) { - _vm->_global->inter_resVal = _vm->_util->getRandom(_vm->_global->inter_resVal); + _vm->_global->_inter_resVal = _vm->_util->getRandom(_vm->_global->_inter_resVal); } - *valPtr = _vm->_global->inter_resVal; + *valPtr = _vm->_global->_inter_resVal; break; } // switch @@ -950,15 +950,15 @@ int16 Parse::parseVarIndex() { int16 offset; int16 val; - operation = *_vm->_global->inter_execPtr++; + operation = *_vm->_global->_inter_execPtr++; debug(5, "var parse = %d", operation); switch (operation) { case 23: case 25: temp = _vm->_inter->load16() * 4; - debug(5, "oper = %d", (int16)*_vm->_global->inter_execPtr); - if (operation == 25 && *_vm->_global->inter_execPtr == 13) { - _vm->_global->inter_execPtr++; + debug(5, "oper = %d", (int16)*_vm->_global->_inter_execPtr); + if (operation == 25 && *_vm->_global->_inter_execPtr == 13) { + _vm->_global->_inter_execPtr++; val = parseValExpr(); temp += val; debug(5, "parse subscript = %d", val); @@ -968,9 +968,9 @@ int16 Parse::parseVarIndex() { case 26: case 28: temp = _vm->_inter->load16() * 4; - dimCount = *_vm->_global->inter_execPtr++; - arrDesc = _vm->_global->inter_execPtr; - _vm->_global->inter_execPtr += dimCount; + dimCount = *_vm->_global->_inter_execPtr++; + arrDesc = _vm->_global->_inter_execPtr; + _vm->_global->_inter_execPtr += dimCount; offset = 0; for (dim = 0; dim < dimCount; dim++) { temp2 = parseValExpr(); @@ -980,11 +980,11 @@ int16 Parse::parseVarIndex() { if (operation != 28) return temp + offset; - if (*_vm->_global->inter_execPtr == 13) { - _vm->_global->inter_execPtr++; + if (*_vm->_global->_inter_execPtr == 13) { + _vm->_global->_inter_execPtr++; temp += parseValExpr(); } - return offset * _vm->_global->inter_animDataSize + temp; + return offset * _vm->_global->_inter_animDataSize + temp; default: return 0; @@ -1006,19 +1006,19 @@ void Parse::printExpr(char arg_0) { return; if (savedPos == 0) { - savedPos = _vm->_global->inter_execPtr; + savedPos = _vm->_global->_inter_execPtr; saved = 1; } num = 0; while (1) { - operation = *_vm->_global->inter_execPtr++; + operation = *_vm->_global->_inter_execPtr++; if (operation >= 19 && operation <= 29) { switch (operation) { case 19: - debug(5, "%l", READ_LE_UINT32(_vm->_global->inter_execPtr)); - _vm->_global->inter_execPtr += 4; + debug(5, "%l", READ_LE_UINT32(_vm->_global->_inter_execPtr)); + _vm->_global->_inter_execPtr += 4; break; case 20: @@ -1026,8 +1026,8 @@ void Parse::printExpr(char arg_0) { break; case 22: - debug(5, "\42%s\42", _vm->_global->inter_execPtr); - _vm->_global->inter_execPtr += strlen(_vm->_global->inter_execPtr) + 1; + debug(5, "\42%s\42", _vm->_global->_inter_execPtr); + _vm->_global->_inter_execPtr += strlen(_vm->_global->_inter_execPtr) + 1; break; case 23: @@ -1036,8 +1036,8 @@ void Parse::printExpr(char arg_0) { case 25: debug(5, "(&var_%d)", _vm->_inter->load16()); - if (*_vm->_global->inter_execPtr == 13) { - _vm->_global->inter_execPtr++; + if (*_vm->_global->_inter_execPtr == 13) { + _vm->_global->_inter_execPtr++; debug(5, "{"); printExpr(12); // debug(5, "}"); @@ -1050,9 +1050,9 @@ void Parse::printExpr(char arg_0) { debug(5, "(&"); debug(5, "var_%d[", _vm->_inter->load16()); - dimCount = *_vm->_global->inter_execPtr++; - arrDesc = _vm->_global->inter_execPtr; - _vm->_global->inter_execPtr += dimCount; + dimCount = *_vm->_global->_inter_execPtr++; + arrDesc = _vm->_global->_inter_execPtr; + _vm->_global->_inter_execPtr += dimCount; for (dim = 0; dim < dimCount; dim++) { printExpr(12); debug(5, " of %d", (int16)arrDesc[dim]); @@ -1063,8 +1063,8 @@ void Parse::printExpr(char arg_0) { if (operation == 28) debug(5, ")"); - if (operation == 28 && *_vm->_global->inter_execPtr == 13) { - _vm->_global->inter_execPtr++; + if (operation == 28 && *_vm->_global->_inter_execPtr == 13) { + _vm->_global->_inter_execPtr++; debug(5, "{"); printExpr(12); // debug(5, "}"); @@ -1072,7 +1072,7 @@ void Parse::printExpr(char arg_0) { break; case 29: - func = *_vm->_global->inter_execPtr++; + func = *_vm->_global->_inter_execPtr++; if (func == 5) debug(5, "sqr("); else if (func == 10) @@ -1204,7 +1204,7 @@ void Parse::printExpr(char arg_0) { if (arg_0 != 10 || num < 0) { if (saved != 0) { - _vm->_global->inter_execPtr = savedPos; + _vm->_global->_inter_execPtr = savedPos; savedPos = 0; } return; @@ -1220,16 +1220,16 @@ void Parse::printVarIndex() { int16 operation; int16 temp; - char *pos = _vm->_global->inter_execPtr; + char *pos = _vm->_global->_inter_execPtr; - operation = *_vm->_global->inter_execPtr++; + operation = *_vm->_global->_inter_execPtr++; switch (operation) { case 23: case 25: temp = _vm->_inter->load16() * 4; debug(5, "&var_%d", temp); - if (operation == 25 && *_vm->_global->inter_execPtr == 13) { - _vm->_global->inter_execPtr++; + if (operation == 25 && *_vm->_global->_inter_execPtr == 13) { + _vm->_global->_inter_execPtr++; debug(5, "+"); printExpr(99); } @@ -1238,9 +1238,9 @@ void Parse::printVarIndex() { case 26: case 28: debug(5, "&var_%d[", _vm->_inter->load16()); - dimCount = *_vm->_global->inter_execPtr++; - arrDesc = _vm->_global->inter_execPtr; - _vm->_global->inter_execPtr += dimCount; + dimCount = *_vm->_global->_inter_execPtr++; + arrDesc = _vm->_global->_inter_execPtr; + _vm->_global->_inter_execPtr += dimCount; for (dim = 0; dim < dimCount; dim++) { printExpr(12); debug(5, " of %d", (int16)arrDesc[dim]); @@ -1249,8 +1249,8 @@ void Parse::printVarIndex() { } debug(5, "]"); - if (operation == 28 && *_vm->_global->inter_execPtr == 13) { - _vm->_global->inter_execPtr++; + if (operation == 28 && *_vm->_global->_inter_execPtr == 13) { + _vm->_global->_inter_execPtr++; debug(5, "+"); printExpr(99); } @@ -1261,7 +1261,7 @@ void Parse::printVarIndex() { break; } debug(5, "\n"); - _vm->_global->inter_execPtr = pos; + _vm->_global->_inter_execPtr = pos; return; } diff --git a/gob/scenery.cpp b/gob/scenery.cpp index 0cd6971c25..b7660f1884 100644 --- a/gob/scenery.cpp +++ b/gob/scenery.cpp @@ -83,14 +83,14 @@ int16 Scenery::loadStatic(char search) { _vm->_inter->evalExpr(&sceneryIndex); tmp = _vm->_inter->load16(); - backsPtr = (int16 *)_vm->_global->inter_execPtr; - _vm->_global->inter_execPtr += tmp * 2; + backsPtr = (int16 *)_vm->_global->_inter_execPtr; + _vm->_global->_inter_execPtr += tmp * 2; picsCount = _vm->_inter->load16(); resId = _vm->_inter->load16(); if (search) { for (i = 0; i < 10; i++) { if (staticPictCount[i] != -1 && staticResId[i] == resId) { - _vm->_global->inter_execPtr += 8 * staticPictCount[i]; + _vm->_global->_inter_execPtr += 8 * staticPictCount[i]; return i; } @@ -170,7 +170,7 @@ int16 Scenery::loadStatic(char search) { spriteRefs[sprIndex] = 1; spriteResId[sprIndex] = sprResId; _vm->_draw->spritesArray[sprIndex] = - _vm->_video->initSurfDesc(_vm->_global->videoMode, width, height, 2); + _vm->_video->initSurfDesc(_vm->_global->_videoMode, width, height, 2); _vm->_video->clearSurf(_vm->_draw->spritesArray[sprIndex]); _vm->_draw->destSurface = sprIndex; @@ -407,7 +407,7 @@ int16 Scenery::loadAnim(char search) { for (i = 0; i < 10; i++) { if (animPictCount[i] != 0 && animResId[i] == resId) { - _vm->_global->inter_execPtr += 8 * animPictCount[i]; + _vm->_global->_inter_execPtr += 8 * animPictCount[i]; return i; } @@ -486,7 +486,7 @@ int16 Scenery::loadAnim(char search) { spriteRefs[sprIndex] = 1; spriteResId[sprIndex] = sprResId; _vm->_draw->spritesArray[sprIndex] = - _vm->_video->initSurfDesc(_vm->_global->videoMode, width, height, 2); + _vm->_video->initSurfDesc(_vm->_global->_videoMode, width, height, 2); _vm->_video->clearSurf(_vm->_draw->spritesArray[sprIndex]); _vm->_draw->destSurface = sprIndex; diff --git a/gob/sound.cpp b/gob/sound.cpp index 3b287badf8..07f2f27dad 100644 --- a/gob/sound.cpp +++ b/gob/sound.cpp @@ -59,21 +59,20 @@ int Snd::SquareWaveStream::readBuffer(int16 *buffer, const int numSamples) { Snd::Snd(GobEngine *vm) : _vm(vm) { //CleanupFuncPtr cleanupFunc;// = &snd_cleanupFuncCallback(); - cleanupFunc = 0; - for (int i = 0; i < ARRAYSIZE(loopingSounds); i++) - loopingSounds[i] = NULL; - soundPort = 0; - playingSound = 0; + _cleanupFunc = 0; + for (int i = 0; i < ARRAYSIZE(_loopingSounds); i++) + _loopingSounds[i] = NULL; + _playingSound = 0; } void Snd::loopSounds(void) { - for (int i = 0; i < ARRAYSIZE(loopingSounds); i++) { - SoundDesc *snd = loopingSounds[i]; + for (int i = 0; i < ARRAYSIZE(_loopingSounds); i++) { + SoundDesc *snd = _loopingSounds[i]; if (snd && !_vm->_mixer->isSoundHandleActive(snd->handle)) { if (snd->repCount-- > 0) { _vm->_mixer->playRaw(&snd->handle, snd->data, snd->size, snd->frequency, 0); } else { - loopingSounds[i] = NULL; + _loopingSounds[i] = NULL; } } } @@ -82,14 +81,14 @@ void Snd::loopSounds(void) { void Snd::setBlasterPort(int16 port) {return;} void Snd::speakerOn(int16 frequency, int32 length) { - speakerStream.playNote(frequency, length, _vm->_mixer->getOutputRate()); - if (!_vm->_mixer->isSoundHandleActive(speakerHandle)) { - _vm->_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &speakerHandle, &speakerStream, -1, 255, 0, false); + _speakerStream.playNote(frequency, length, _vm->_mixer->getOutputRate()); + if (!_vm->_mixer->isSoundHandleActive(_speakerHandle)) { + _vm->_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_speakerHandle, &_speakerStream, -1, 255, 0, false); } } void Snd::speakerOff(void) { - _vm->_mixer->stopHandle(speakerHandle); + _vm->_mixer->stopHandle(_speakerHandle); } void Snd::playSample(Snd::SoundDesc *sndDesc, int16 repCount, int16 frequency) { @@ -103,9 +102,9 @@ void Snd::playSample(Snd::SoundDesc *sndDesc, int16 repCount, int16 frequency) { sndDesc->frequency = frequency; if (repCount > 1) { - for (int i = 0; i < ARRAYSIZE(loopingSounds); i++) { - if (!loopingSounds[i]) { - loopingSounds[i] = sndDesc; + for (int i = 0; i < ARRAYSIZE(_loopingSounds); i++) { + if (!_loopingSounds[i]) { + _loopingSounds[i] = sndDesc; return; } } @@ -132,9 +131,9 @@ Snd::SoundDesc *Snd::loadSoundData(const char *path) { void Snd::freeSoundData(Snd::SoundDesc *sndDesc) { _vm->_mixer->stopHandle(sndDesc->handle); - for (int i = 0; i < ARRAYSIZE(loopingSounds); i++) { - if (loopingSounds[i] == sndDesc) - loopingSounds[i] = NULL; + for (int i = 0; i < ARRAYSIZE(_loopingSounds); i++) { + if (_loopingSounds[i] == sndDesc) + _loopingSounds[i] = NULL; } free(sndDesc->data); diff --git a/gob/sound.h b/gob/sound.h index 60750874f4..690a92bca3 100644 --- a/gob/sound.h +++ b/gob/sound.h @@ -43,10 +43,9 @@ public: typedef void (*CleanupFuncPtr) (int16); - SoundDesc *loopingSounds[5]; // Should be enough - int16 soundPort; - char playingSound; - CleanupFuncPtr cleanupFunc; + SoundDesc *_loopingSounds[5]; // Should be enough + char _playingSound; + CleanupFuncPtr _cleanupFunc; Snd(GobEngine *vm); void speakerOn(int16 frequency, int32 length); @@ -84,8 +83,8 @@ protected: int getRate() const { return _rate; } }; - SquareWaveStream speakerStream; - Audio::SoundHandle speakerHandle; + SquareWaveStream _speakerStream; + Audio::SoundHandle _speakerHandle; GobEngine *_vm; diff --git a/gob/util.cpp b/gob/util.cpp index 7d5b574b97..84ca7b706c 100644 --- a/gob/util.cpp +++ b/gob/util.cpp @@ -183,7 +183,7 @@ void Util::setMousePos(int16 x, int16 y) { void Util::longDelay(uint16 msecs) { uint32 time = g_system->getMillis() + msecs; do { - _vm->_video->waitRetrace(_vm->_global->videoMode); + _vm->_video->waitRetrace(_vm->_global->_videoMode); processInput(); delay(25); } while (g_system->getMillis() < time); @@ -194,7 +194,7 @@ void Util::delay(uint16 msecs) { } void Util::beep(int16 freq) { - if (_vm->_global->soundFlags == 0) + if (_vm->_global->_soundFlags == 0) return; _vm->_snd->speakerOn(freq, 50); @@ -235,31 +235,31 @@ int16 Util::calcDelayTime() { /* NOT IMPLEMENTED */ void Util::checkJoystick() { - _vm->_global->useJoystick = 0; + _vm->_global->_useJoystick = 0; } void Util::setFrameRate(int16 rate) { if (rate == 0) rate = 1; - _vm->_global->frameWaitTime = 1000 / rate; - _vm->_global->startFrameTime = getTimeKey(); + _vm->_global->_frameWaitTime = 1000 / rate; + _vm->_global->_startFrameTime = getTimeKey(); } void Util::waitEndFrame() { int32 time; - _vm->_video->waitRetrace(_vm->_global->videoMode); + _vm->_video->waitRetrace(_vm->_global->_videoMode); - time = getTimeKey() - _vm->_global->startFrameTime; + time = getTimeKey() - _vm->_global->_startFrameTime; if (time > 1000 || time < 0) { - _vm->_global->startFrameTime = getTimeKey(); + _vm->_global->_startFrameTime = getTimeKey(); return; } - if (_vm->_global->frameWaitTime - time > 0) { - delay(_vm->_global->frameWaitTime - time); + if (_vm->_global->_frameWaitTime - time > 0) { + delay(_vm->_global->_frameWaitTime - time); } - _vm->_global->startFrameTime = getTimeKey(); + _vm->_global->_startFrameTime = getTimeKey(); } int16 joy_getState() { @@ -311,11 +311,11 @@ void Util::clearPalette(void) { int16 i; byte colors[768]; - if (_vm->_global->videoMode != 0x13) + if (_vm->_global->_videoMode != 0x13) error("clearPalette: Video mode 0x%x is not supported!", - _vm->_global->videoMode); + _vm->_global->_videoMode); - if (_vm->_global->setAllPalette) { + if (_vm->_global->_setAllPalette) { for (i = 0; i < 768; i++) colors[i] = 0; g_system->setPalette(colors, 0, 256); @@ -324,7 +324,7 @@ void Util::clearPalette(void) { } for (i = 0; i < 16; i++) - _vm->_video->setPalElem(i, 0, 0, 0, 0, _vm->_global->videoMode); + _vm->_video->setPalElem(i, 0, 0, 0, 0, _vm->_global->_videoMode); } void Util::insertStr(const char *str1, char *str2, int16 pos) { diff --git a/gob/video.cpp b/gob/video.cpp index 934ef29bbf..5932645e56 100644 --- a/gob/video.cpp +++ b/gob/video.cpp @@ -36,8 +36,8 @@ Video::Video(GobEngine *vm) : _vm(vm) { //XXX: Use this function to update the screen for now. // This should be moved to a better location later on. void Video::waitRetrace(int16) { - if (_vm->_global->pPrimarySurfDesc) { - g_system->copyRectToScreen(_vm->_global->pPrimarySurfDesc->vidPtr, 320, 0, 0, 320, 200); + if (_vm->_global->_pPrimarySurfDesc) { + g_system->copyRectToScreen(_vm->_global->_pPrimarySurfDesc->vidPtr, 320, 0, 0, 320, 200); g_system->updateScreen(); } } @@ -91,10 +91,10 @@ Video::SurfaceDesc *Video::initSurfDesc(int16 vidMode, int16 width, int16 height SurfaceDesc *descPtr; if (flags != PRIMARY_SURFACE) - _vm->_global->sprAllocated++; + _vm->_global->_sprAllocated++; if (flags & RETURN_PRIMARY) - return _vm->_global->pPrimarySurfDesc; + return _vm->_global->_pPrimarySurfDesc; if (vidMode != 0x13) error("Video::initSurfDesc: Only VGA 0x13 mode is supported!"); @@ -109,10 +109,10 @@ Video::SurfaceDesc *Video::initSurfDesc(int16 vidMode, int16 width, int16 height if (flags & PRIMARY_SURFACE) { vidMem = 0; - _vm->_global->primaryWidth = width; - _vm->_global->mouseMaxCol = width; - _vm->_global->primaryHeight = height; - _vm->_global->mouseMaxRow = height; + _vm->_global->_primaryWidth = width; + _vm->_global->_mouseMaxCol = width; + _vm->_global->_primaryHeight = height; + _vm->_global->_mouseMaxRow = height; sprSize = 0; } else { @@ -122,7 +122,7 @@ Video::SurfaceDesc *Video::initSurfDesc(int16 vidMode, int16 width, int16 height someFlags += 0x80; } if (flags & PRIMARY_SURFACE) { - descPtr = _vm->_global->pPrimarySurfDesc; + descPtr = _vm->_global->_pPrimarySurfDesc; vidMem = (byte *)malloc(320 * 200); } else { if (flags & DISABLE_SPR_ALLOC) @@ -147,8 +147,8 @@ Video::SurfaceDesc *Video::initSurfDesc(int16 vidMode, int16 width, int16 height } void Video::freeSurfDesc(SurfaceDesc * surfDesc) { - _vm->_global->sprAllocated--; - if (surfDesc != _vm->_global->pPrimarySurfDesc) + _vm->_global->_sprAllocated--; + if (surfDesc != _vm->_global->_pPrimarySurfDesc) free(surfDesc); else free(surfDesc->vidPtr); @@ -170,7 +170,7 @@ void Video::drawSprite(SurfaceDesc *source, SurfaceDesc *dest, int16 destRight; int16 destBottom; - if (_vm->_global->doRangeClamp) { + if (_vm->_global->_doRangeClamp) { if (left > right) { temp = left; left = right; @@ -240,7 +240,7 @@ void Video::fillRect(SurfaceDesc *dest, int16 left, int16 top, int16 right, int1 int16 color) { int16 temp; - if (_vm->_global->doRangeClamp) { + if (_vm->_global->_doRangeClamp) { if (left > right) { temp = left; left = right; @@ -312,9 +312,9 @@ void Video::setPalElem(int16 index, char red, char green, char blue, int16 unuse int16 vidMode) { byte pal[4]; - _vm->_global->redPalette[index] = red; - _vm->_global->greenPalette[index] = green; - _vm->_global->bluePalette[index] = blue; + _vm->_global->_redPalette[index] = red; + _vm->_global->_greenPalette[index] = green; + _vm->_global->_bluePalette[index] = blue; if (vidMode != 0x13) error("Video::setPalElem: Video mode 0x%x is not supported!", @@ -332,11 +332,11 @@ void Video::setPalette(PalDesc *palDesc) { byte pal[1024]; int16 numcolors; - if (_vm->_global->videoMode != 0x13) + if (_vm->_global->_videoMode != 0x13) error("Video::setPalette: Video mode 0x%x is not supported!", - _vm->_global->videoMode); + _vm->_global->_videoMode); - if (_vm->_global->setAllPalette) + if (_vm->_global->_setAllPalette) numcolors = 256; else numcolors = 16; @@ -356,12 +356,12 @@ void Video::setFullPalette(PalDesc *palDesc) { int16 i; byte pal[1024]; - if (_vm->_global->setAllPalette) { + if (_vm->_global->_setAllPalette) { colors = palDesc->vgaPal; for (i = 0; i < 256; i++) { - _vm->_global->redPalette[i] = colors[i].red; - _vm->_global->greenPalette[i] = colors[i].green; - _vm->_global->bluePalette[i] = colors[i].blue; + _vm->_global->_redPalette[i] = colors[i].red; + _vm->_global->_greenPalette[i] = colors[i].green; + _vm->_global->_bluePalette[i] = colors[i].blue; } for (i = 0; i < 256; i++) { @@ -378,36 +378,36 @@ void Video::setFullPalette(PalDesc *palDesc) { void Video::initPrimary(int16 mode) { int16 old; - if (_vm->_global->curPrimaryDesc) { - Video::freeSurfDesc(_vm->_global->curPrimaryDesc); - Video::freeSurfDesc(_vm->_global->allocatedPrimary); + if (_vm->_global->_curPrimaryDesc) { + Video::freeSurfDesc(_vm->_global->_curPrimaryDesc); + Video::freeSurfDesc(_vm->_global->_allocatedPrimary); - _vm->_global->curPrimaryDesc = 0; - _vm->_global->allocatedPrimary = 0; + _vm->_global->_curPrimaryDesc = 0; + _vm->_global->_allocatedPrimary = 0; } if (mode != 0x13 && mode != 3 && mode != -1) error("Video::initPrimary: Video mode 0x%x is not supported!", mode); - if (_vm->_global->videoMode != 0x13) + if (_vm->_global->_videoMode != 0x13) error("Video::initPrimary: Video mode 0x%x is not supported!", mode); - old = _vm->_global->oldMode; + old = _vm->_global->_oldMode; if (mode == -1) mode = 3; - _vm->_global->oldMode = mode; + _vm->_global->_oldMode = mode; if (mode != 3) Video::initDriver(mode); if (mode != 3) { Video::initSurfDesc(mode, 320, 200, PRIMARY_SURFACE); - if (_vm->_global->dontSetPalette) + if (_vm->_global->_dontSetPalette) return; - Video::setFullPalette(_vm->_global->pPaletteDesc); + Video::setFullPalette(_vm->_global->_pPaletteDesc); } } @@ -540,6 +540,6 @@ char Video::spriteUncompressor(byte *sprBuf, int16 srcWidth, int16 srcHeight, return 1; } -void Video::setHandlers() { _vm->_global->setAllPalette = 1; } +void Video::setHandlers() { _vm->_global->_setAllPalette = 1; } } // End of namespace Gob |