diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/hopkins/anim.cpp | 12 | ||||
-rw-r--r-- | engines/hopkins/computer.cpp | 47 | ||||
-rw-r--r-- | engines/hopkins/events.cpp | 2 | ||||
-rw-r--r-- | engines/hopkins/font.cpp | 52 | ||||
-rw-r--r-- | engines/hopkins/graphics.cpp | 149 | ||||
-rw-r--r-- | engines/hopkins/graphics.h | 4 | ||||
-rw-r--r-- | engines/hopkins/hopkins.cpp | 5 | ||||
-rw-r--r-- | engines/hopkins/objects.cpp | 317 | ||||
-rw-r--r-- | engines/hopkins/objects.h | 6 | ||||
-rw-r--r-- | engines/hopkins/script.cpp | 50 | ||||
-rw-r--r-- | engines/hopkins/talk.cpp | 49 |
11 files changed, 281 insertions, 412 deletions
diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 8b9945a429..36466a2090 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -319,7 +319,7 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint _vm->_graphicsManager.unlockScreen(); _vm->_graphicsManager.SCROLL = v11; _vm->_graphicsManager.scrollScreen(v11); - if (_vm->_graphicsManager.DOUBLE_ECRAN) { + if (_vm->_graphicsManager._largeScreenFl) { _vm->_graphicsManager.SCANLINE(1280); _vm->_graphicsManager.max_x = 1280; _vm->_graphicsManager.lockScreen(); @@ -449,7 +449,7 @@ LABEL_114: _vm->_graphicsManager.unlockScreen(); _vm->_graphicsManager.SCROLL = v11; _vm->_graphicsManager.scrollScreen(v11); - if (_vm->_graphicsManager.DOUBLE_ECRAN) { + if (_vm->_graphicsManager._largeScreenFl) { _vm->_graphicsManager.SCANLINE(1280); _vm->_graphicsManager.max_x = 1280; _vm->_graphicsManager.lockScreen(); @@ -680,8 +680,8 @@ void AnimationManager::searchAnim(const byte *data, int animIndex, int count) { WRITE_LE_UINT16(dataP + 22, v11); WRITE_LE_UINT16(dataP + 24, v22); WRITE_LE_UINT16(dataP + 26, v12); - *(dataP + 28) = *(v21 + data + 33); - *(dataP + 29) = *(v21 + data + 34); + dataP[28] = data[v21 + 33]; + dataP[29] = data[v21 + 34]; for (int v14 = 1; v14 <= 4999; v14++) { v9 += 10; @@ -697,8 +697,8 @@ void AnimationManager::searchAnim(const byte *data, int animIndex, int count) { WRITE_LE_UINT16(v9 + 2, v15); WRITE_LE_UINT16(v9 + 4, v22); WRITE_LE_UINT16(v9 + 6, v16); - *(v9 + 8) = *(v23 + 8); - *(v9 + 9) = *(v23 + 9); + v9[8] = v23[8]; + v9[9] = v23[9]; } loopCond = true; } diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 52ca3af693..068792d7a4 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -240,7 +240,7 @@ void ComputerManager::showComputer(ComputerEnum mode) { switch (keyPressed) { case '2': readText(6); - break; + break; case '3': readText(7); break; @@ -482,8 +482,7 @@ void ComputerManager::restoreFBIRoom() { */ void ComputerManager::readText(int idx) { uint16 v1; - int v2; - uint16 v3; + bool foundFl; int v4; int v5; int v6; @@ -506,21 +505,18 @@ void ComputerManager::readText(int idx) { ptr = _vm->_fileManager.loadFile(_vm->_globals._curFilename); v1 = _vm->_fileManager.fileSize(_vm->_globals._curFilename); - v2 = 0; - v3 = 0; - if (v1 > 0u) { - do { - if (*(ptr + v3) == '%') { - numStr = Common::String::format("%c%c", *(ptr + v3 + 1), *(ptr + v3 + 2)); - num = atol(numStr.c_str()); + foundFl = false; + int v3; + for (v3 = 0; v3 < v1; v3++) { + if (ptr[v3] == '%') { + numStr = Common::String::format("%c%c", ptr[v3 + 1], ptr[v3 + 2]); + num = atol(numStr.c_str()); - if (num == idx) - v2 = 1; - } - if (v2 == 1) - break; - ++v3; - } while (v3 < v1); + if (num == idx) + foundFl = true; + } + if (foundFl) + break; } v4 = v3; if (v3 > v1 - 1) @@ -531,10 +527,8 @@ void ComputerManager::readText(int idx) { v6 = 5; v7 = 0; do { - v4 = *(ptr + v10); + v4 = ptr[v10]; if (v4 == 13) { -// v12[v7] = 0; -// v7 = 0; v8 = v4; setTextPosition(v6, v5); outText(v12); @@ -545,7 +539,6 @@ void ComputerManager::readText(int idx) { v4 = v8; v12 = ""; } else if (v4 != '%') { - //v12[v7++] = v4; v12 += v4; ++v7; } @@ -619,14 +612,14 @@ void ComputerManager::loadHiscore() { for (int scoreIndex = 0; scoreIndex < 6; ++scoreIndex) { for (int i = 0; i < 5; ++i) { - nextChar = *(ptr + i + (16 * scoreIndex)); + nextChar = ptr[i + (16 * scoreIndex)]; if (!nextChar) nextChar = ' '; _score[scoreIndex]._name += nextChar; } for (int i = 0; i < 9; ++i) { - nextChar = *(ptr + i + scoreIndex * 16 + 6); + nextChar = ptr[i + scoreIndex * 16 + 6]; if (!nextChar) nextChar = '0'; _score[scoreIndex]._score += nextChar; @@ -1047,19 +1040,19 @@ void ComputerManager::saveScore() { v8 = _score[v14]._name[v7]; if (!v8) v8 = 32; - *(ptr + (16 * v5) + v7) = v8; + ptr[(16 * v5) + v7] = v8; }; - *(ptr + v6 + 5) = 0; + ptr[v6 + 5] = 0; v9 = v6 + 6; for (int v10 = 0; v10 <= 8; v10++) { v11 = _score[v14]._score[v10]; if (!v11) v11 = 48; - *(ptr + v9 + v10) = v11; + ptr[v9 + v10] = v11; }; - *(ptr + v9 + 9) = 0; + ptr[v9 + 9] = 0; } _vm->_fileManager.constructLinuxFilename("HISCORE.DAT"); diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 1f85e3eeda..18f0aa420c 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -418,7 +418,7 @@ LABEL_63: LABEL_65: _vm->_globals._speed = 2; _rateCounter = 0; - if (!_vm->_graphicsManager.DOUBLE_ECRAN || _vm->_graphicsManager.no_scroll == 1) { + if (!_vm->_graphicsManager._largeScreenFl || _vm->_graphicsManager.no_scroll == 1) { _vm->_graphicsManager.Affiche_Segment_Vesa(); } else { if (_vm->_graphicsManager.no_scroll != 2) { diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp index 9ac2446548..0282e88cc4 100644 --- a/engines/hopkins/font.cpp +++ b/engines/hopkins/font.cpp @@ -355,12 +355,12 @@ LABEL_57: } } _vm->_globals.hauteur_boite = (_vm->_globals.police_h + 1) * lineCount + 2; - int v56 = v73; - int v55 = yp; - int v53 = _vm->_globals._boxWidth + 10; - int v51 = (_vm->_globals.police_h + 1) * lineCount + 12; + int posX = v73; + int posY = yp; + int saveWidth = _vm->_globals._boxWidth + 10; + int saveHeight = (_vm->_globals.police_h + 1) * lineCount + 12; if (_text[idx]._textType == 6) { - int v27 = v53 / 2; + int v27 = saveWidth / 2; if (v27 < 0) v27 = -v27; _text[idx]._pos.x = 315 - v27; @@ -368,37 +368,36 @@ LABEL_57: v73 = _vm->_eventsManager._startPos.x + 315 - v27; _text[idx]._pos.y = 50; v70 = 50; - v55 = 50; - v56 = v28; + posY = 50; + posX = v28; } int textType = _text[idx]._textType; if (textType == 1 || textType == 3 || textType == 5 || textType == 6) { - int v49 = v51 * v53; - byte *ptrd = _vm->_globals.allocMemory(v49); - if (ptrd == g_PTRNUL) { - error("Cutting a block for text box (%d)", v49); - } - _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager._vesaBuffer, ptrd, v56, v55, v53, v51); - _vm->_graphicsManager.Trans_bloc2(ptrd, _vm->_graphicsManager._colorTable, v49); - _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, ptrd, v56, v55, v53, v51); + int size = saveHeight * saveWidth; + byte *ptrd = _vm->_globals.allocMemory(size); + if (ptrd == g_PTRNUL) + error("Cutting a block for text box (%d)", size); + + _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager._vesaBuffer, ptrd, posX, posY, saveWidth, saveHeight); + _vm->_graphicsManager.Trans_bloc2(ptrd, _vm->_graphicsManager._colorTable, size); + _vm->_graphicsManager.Restore_Mem(_vm->_graphicsManager._vesaBuffer, ptrd, posX, posY, saveWidth, saveHeight); _vm->_globals.freeMemory(ptrd); - _vm->_graphicsManager.drawHorizontalLine(_vm->_graphicsManager._vesaBuffer, v56, v55, v53, (byte)-2); - _vm->_graphicsManager.drawHorizontalLine(_vm->_graphicsManager._vesaBuffer, v56, v51 + v55, v53, (byte)-2); - _vm->_graphicsManager.drawVerticalLine(_vm->_graphicsManager._vesaBuffer, v56, v70, v51, (byte)-2); - _vm->_graphicsManager.drawVerticalLine(_vm->_graphicsManager._vesaBuffer, v53 + v56, v70, v51, (byte)-2); + _vm->_graphicsManager.drawHorizontalLine(_vm->_graphicsManager._vesaBuffer, posX, posY, saveWidth, (byte)-2); + _vm->_graphicsManager.drawHorizontalLine(_vm->_graphicsManager._vesaBuffer, posX, saveHeight + posY, saveWidth, (byte)-2); + _vm->_graphicsManager.drawVerticalLine(_vm->_graphicsManager._vesaBuffer, posX, posY, saveHeight, (byte)-2); + _vm->_graphicsManager.drawVerticalLine(_vm->_graphicsManager._vesaBuffer, saveWidth + posX, posY, saveHeight, (byte)-2); } _text[idx]._lineCount = lineCount; - int v75 = v73 + 5; - int v71 = v70 + 5; + int v71 = posY + 5; for (int lineNum = 0; lineNum < lineCount; ++lineNum) { - displayText(v75, v71, _text[idx]._lines[lineNum], _text[idx]._color); + displayText(v73 + 5, v71, _text[idx]._lines[lineNum], _text[idx]._color); v71 += _vm->_globals.police_h + 1; } - int blockWidth = v53 + 1; - int blockHeight = v51 + 1; + int blockWidth = saveWidth + 1; + int blockHeight = saveHeight + 1; _text[idx]._width = blockWidth; _text[idx]._height = blockHeight; @@ -413,7 +412,7 @@ LABEL_57: _text[idx]._textBlock = ptre; _text[idx]._width = blockWidth; _text[idx]._height = blockHeight; - _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager._vesaBuffer, _text[idx]._textBlock, v56, v55, _text[idx]._width, blockHeight); + _vm->_graphicsManager.Capture_Mem(_vm->_graphicsManager._vesaBuffer, _text[idx]._textBlock, posX, posY, _text[idx]._width, blockHeight); } _tempText = _vm->_globals.freeMemory(_tempText); } @@ -423,12 +422,11 @@ LABEL_57: * Directly display text (using a VESA segment) */ void FontManager::displayTextVesa(int xp, int yp, const Common::String &message, int col) { - const char *srcP; char currChar; int charIndex; int currentX = xp; - srcP = message.c_str(); + const char *srcP = message.c_str(); for (;;) { currChar = *srcP++; if (!currChar) diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index b7cbd55694..0d4073d67d 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -43,8 +43,7 @@ GraphicsManager::GraphicsManager() { _videoPtr = NULL; _scrollOffset = 0; SCROLL = 0; - PCX_L = PCX_H = 0; - DOUBLE_ECRAN = false; + _largeScreenFl = false; OLD_SCROLL = 0; _lineNbr2 = 0; @@ -196,13 +195,13 @@ void GraphicsManager::loadScreen(const Common::String &file) { } scrollScreen(0); - A_PCX640_480((byte *)_vesaScreen, file, _palette, flag); + A_PCX640_480(_vesaScreen, file, _palette, flag); SCROLL = 0; OLD_SCROLL = 0; clearPalette(); - if (!DOUBLE_ECRAN) { + if (!_largeScreenFl) { SCANLINE(SCREEN_WIDTH); max_x = SCREEN_WIDTH; lockScreen(); @@ -254,20 +253,19 @@ void GraphicsManager::scrollScreen(int amount) { } void GraphicsManager::Trans_bloc(byte *destP, const byte *srcP, int count, int minThreshold, int maxThreshold) { - byte *destPosP; int palIndex; int srcOffset; int col1, col2; - destPosP = destP; + byte *destPosP = destP; for (int idx = 0; idx < count; ++idx) { - palIndex = *(byte *)destPosP++; + palIndex = *destPosP; srcOffset = 3 * palIndex; - col1 = *(srcP + srcOffset) + *(srcP + srcOffset + 1) + *(srcP + srcOffset + 2); + col1 = srcP[srcOffset] + srcP[srcOffset + 1] + srcP[srcOffset + 2]; for (int idx2 = 0; idx2 < 38; ++idx2) { srcOffset = 3 * idx2; - col2 = *(srcP + srcOffset) + *(srcP + srcOffset + 1) + *(srcP + srcOffset + 2); + col2 = srcP[srcOffset] + srcP[srcOffset + 1] + srcP[srcOffset + 2]; col2 += minThreshold; if (col2 < col1) @@ -277,9 +275,10 @@ void GraphicsManager::Trans_bloc(byte *destP, const byte *srcP, int count, int m if (col2 > col1) continue; - *(destPosP - 1) = (idx2 == 0) ? 1 : idx2; + *destPosP = (idx2 == 0) ? 1 : idx2; break; } + destPosP++; } } @@ -288,12 +287,12 @@ void GraphicsManager::Trans_bloc2(byte *surface, byte *col, int size) { byte *dataP = surface; for (int count = size - 1; count; count--){ - dataVal = *dataP++; - *(dataP - 1) = *(dataVal + col); + dataVal = *dataP; + *dataP = col[dataVal]; + dataP++; } } -// TODO: See if it's feasible and/or desirable to change this to use the Common PCX decoder void GraphicsManager::A_PCX640_480(byte *surface, const Common::String &file, byte *palette, bool typeFlag) { Common::File f; Graphics::PCXDecoder pcxDecoder; @@ -322,9 +321,7 @@ void GraphicsManager::A_PCX640_480(byte *surface, const Common::String &file, by const Graphics::Surface *s = pcxDecoder.getSurface(); // Copy out the dimensions and pixels of the decoded surface - DOUBLE_ECRAN = s->w > SCREEN_WIDTH; - PCX_L = s->w; - PCX_H = s->h; + _largeScreenFl = s->w > SCREEN_WIDTH; Common::copy((byte *)s->pixels, (byte *)s->pixels + (s->pitch * s->h), surface); // Copy out the palette @@ -378,11 +375,9 @@ void GraphicsManager::A_PCX320(byte *surface, const Common::String &file, byte * v5 = 64000; if (!v16) v5 = v17; -// v8 = i; f.read(ptr, v5); -// i = v8; } - v9 = *(ptr + v7++); + v9 = ptr[v7++]; if (v9 > 192) { v10 = v9 - 192; if (v7 == v5) { @@ -391,17 +386,15 @@ void GraphicsManager::A_PCX320(byte *surface, const Common::String &file, byte * v5 = 64000; if (v16 == 1) v5 = v17; -// v11 = i; f.read(ptr, v5); -// i = v11; } - v12 = *(ptr + v7++); + v12 = ptr[v7++]; do { - *(surface + i++) = v12; + surface[i++] = v12; --v10; } while (v10); } else { - *(surface + i++) = v9; + surface[i++] = v9; } } @@ -421,32 +414,6 @@ void GraphicsManager::SCANLINE(int pitch) { _lineNbr = _lineNbr2 = pitch; } -void GraphicsManager::m_scroll(const byte *surface, int xs, int ys, int width, int height, int destX, int destY) { - const byte *srcP; - byte *destP; - int yNext; - int yCtr; - byte *dest2P; - const byte *src2P; - unsigned int widthRemaining; - - assert(_videoPtr); - srcP = xs + _lineNbr2 * ys + surface; - destP = destX + WinScan * destY + (byte *)_videoPtr->pixels; - yNext = height; - do { - yCtr = yNext; - memcpy((byte *)destP, (const byte *)srcP, 4 * (width >> 2)); - src2P = (const byte *)(srcP + 4 * (width >> 2)); - dest2P = (byte *)(destP + 4 * (width >> 2)); - widthRemaining = width - 4 * (width >> 2); - memcpy(dest2P, src2P, widthRemaining); - destP = dest2P + widthRemaining + WinScan - width; - srcP = src2P + widthRemaining + _lineNbr2 - width; - yNext = yCtr - 1; - } while (yCtr != 1); -} - /** * Copies data from a 8-bit palette surface into the 16-bit screen */ @@ -807,40 +774,41 @@ void GraphicsManager::Copy_WinScan_Vbe3(const byte *srcData, byte *destSurface) return; if (srcByte < kSetOffset) { - destOffset += (byte)(*srcP + 35); - srcByte = *(srcP++ + 1); + destOffset += srcP[35]; + srcByte = srcP[1]; + srcP++; } else if (srcByte == k8bVal) { - destOffset += *(srcP + 1); - srcByte = *(srcP + 2); + destOffset += srcP[1]; + srcByte = srcP[2]; srcP += 2; } else if (srcByte == k16bVal) { destOffset += READ_LE_UINT16(srcP + 1); - srcByte = *(srcP + 3); + srcByte = srcP[3]; srcP += 3; } else { destOffset += READ_LE_UINT32(srcP + 1); - srcByte = *(srcP + 5); + srcByte = srcP[5]; srcP += 5; } Video_Cont3_wVbe: if (srcByte > 210) { - if (srcByte == (byte)-45) { - destLen1 = *(srcP + 1); - rleValue = *(srcP + 2); + if (srcByte == -45) { + destLen1 = srcP[1]; + rleValue = srcP[2]; destSlice1P = destOffset + destSurface; destOffset += destLen1; memset(destSlice1P, rleValue, destLen1); srcP += 3; } else { - destLen2 = (byte)(*srcP + 45); - rleValue = *(srcP + 1); + destLen2 = srcP[45]; + rleValue = srcP[1]; destSlice2P = destOffset + destSurface; destOffset += destLen2; memset(destSlice2P, rleValue, destLen2); srcP += 2; } } else { - *(destOffset + destSurface) = srcByte; + destSurface[destOffset] = srcByte; ++srcP; ++destOffset; } @@ -861,16 +829,16 @@ void GraphicsManager::Copy_Video_Vbe16(const byte *srcData) { destOffset += srcByte - 221; srcByte = *++srcP; } else if (srcByte == k8bVal) { - destOffset += *(const byte *)(srcP + 1); - srcByte = *(const byte *)(srcP + 2); + destOffset += srcP[1]; + srcByte = srcP[2]; srcP += 2; } else if (srcByte == k16bVal) { destOffset += READ_LE_UINT16(srcP + 1); - srcByte = *(const byte *)(srcP + 3); + srcByte = srcP[3]; srcP += 3; } else { destOffset += READ_LE_UINT32(srcP + 1); - srcByte = *(const byte *)(srcP + 5); + srcByte = srcP[5]; srcP += 5; } } @@ -882,8 +850,8 @@ void GraphicsManager::Copy_Video_Vbe16(const byte *srcData) { if (srcByte > 210) { if (srcByte == 211) { - int pixelCount = *(srcP + 1); - int pixelIndex = *(srcP + 2); + int pixelCount = srcP[1]; + int pixelIndex = srcP[2]; uint16 *destP = (uint16 *)((byte *)_videoPtr->pixels + destOffset * 2); uint16 pixelValue = *(uint16 *)(PAL_PIXELS + 2 * pixelIndex); destOffset += pixelCount; @@ -894,7 +862,7 @@ void GraphicsManager::Copy_Video_Vbe16(const byte *srcData) { srcP += 3; } else { int pixelCount = srcByte - 211; - int pixelIndex = *(srcP + 1); + int pixelIndex = srcP[1]; uint16 *destP = (uint16 *)((byte *)_videoPtr->pixels + destOffset * 2); uint16 pixelValue = *(uint16 *)(PAL_PIXELS + 2 * pixelIndex); destOffset += pixelCount; @@ -926,16 +894,16 @@ void GraphicsManager::Copy_Video_Vbe16a(const byte *srcData) { if (pixelIndex == kByteStop) return; if (pixelIndex == k8bVal) { - destOffset += *(srcP + 1); - pixelIndex = *(srcP + 2); + destOffset += srcP[1]; + pixelIndex = srcP[2]; srcP += 2; } else if (pixelIndex == k16bVal) { destOffset += READ_LE_UINT16(srcP + 1); - pixelIndex = *(srcP + 3); + pixelIndex = srcP[3]; srcP += 3; } else { destOffset += READ_LE_UINT32(srcP + 1); - pixelIndex = *(srcP + 5); + pixelIndex = srcP[5]; srcP += 5; } Video_Cont_Vbe16a: @@ -1313,10 +1281,10 @@ void GraphicsManager::CopyAsm16(const byte *surface) { v6 = (uint16 *)(v5 + 2 * *v1); v = *v6; *v2 = *v6; - *(v2 + 1) = v; + v2[1] = v; v8 = (uint16 *)(WinScan + v2); *v8 = v; - *(v8 + 1) = v; + v8[1] = v; ++v1; v2 = (byte *)v8 - WinScan + 4; } @@ -1886,7 +1854,7 @@ void GraphicsManager::OPTI_INI(const Common::String &file, int mode) { _vm->_globals.SPRITE_ECRAN = _vm->_fileManager.loadFile(_vm->_globals._curFilename); } } - if (*ptr != 'I' || *(ptr + 1) != 'N' || *(ptr + 2) != 'I') { + if (ptr[0] != 'I' || ptr[1] != 'N' || ptr[2] != 'I') { error("Error, file not ini"); } else { bool doneFlag = false; @@ -1927,9 +1895,6 @@ void GraphicsManager::OPTI_INI(const Common::String &file, int mode) { } void GraphicsManager::NB_SCREEN() { - byte *destP; - const byte *srcP; - if (!_vm->_globals.NECESSAIRE) initColorTable(50, 65, _palette); @@ -1942,13 +1907,7 @@ void GraphicsManager::NB_SCREEN() { m_scroll16(_vesaBuffer, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); unlockScreen(); - destP = _vesaScreen; - srcP = _vesaBuffer; - memcpy(_vesaScreen, _vesaBuffer, 614396); - srcP = srcP + 614396; - destP = destP + 614396; - *destP = *srcP; - *(destP + 2) = *(srcP + 2); + memcpy(_vesaScreen, _vesaBuffer, 614399); DD_VBL(); } @@ -1972,20 +1931,20 @@ void GraphicsManager::Copy_WinScan_Vbe(const byte *src, byte *dest) { if (byteVal == kByteStop) return; if (byteVal == k8bVal) { - destOffset += *(srcPtr + 1); - byteVal = *(srcPtr + 2); + destOffset += srcPtr[1]; + byteVal = srcPtr[2]; srcPtr += 2; } else if (byteVal == k16bVal) { destOffset += READ_LE_UINT16(srcPtr + 1); - byteVal = *(srcPtr + 3); + byteVal = srcPtr[3]; srcPtr += 3; } else { destOffset += READ_LE_UINT32(srcPtr + 1); - byteVal = *(srcPtr + 5); + byteVal = srcPtr[5]; srcPtr += 5; } Video_Cont_wVbe: - *(dest + destOffset) = byteVal; + dest[destOffset] = byteVal; ++srcPtr; ++destOffset; } @@ -2007,16 +1966,16 @@ void GraphicsManager::Copy_Video_Vbe(const byte *src) { if (byteVal == kByteStop) return; if (byteVal == k8bVal) { - destOffset += *(srcP + 1); - byteVal = *(srcP + 2); + destOffset += srcP[1]; + byteVal = srcP[2]; srcP += 2; } else if (byteVal == k16bVal) { destOffset += READ_LE_UINT16(srcP + 1); - byteVal = *(srcP + 3); + byteVal = srcP[3]; srcP += 3; } else { destOffset += READ_LE_UINT32(srcP + 1); - byteVal = *(srcP + 5); + byteVal = srcP[5]; srcP += 5; } } diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 6215e16cc3..f62fcb5026 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -70,8 +70,7 @@ public: int _scrollOffset; int SCROLL; byte HEADER_PCX[128]; - int PCX_L, PCX_H; - bool DOUBLE_ECRAN; + bool _largeScreenFl; int OLD_SCROLL; bool MANU_SCROLL; int _scrollSpeed; @@ -114,7 +113,6 @@ public: void A_PCX320(byte *surface, const Common::String &file, byte *palette); void clearPalette(); void SCANLINE(int pitch); - void m_scroll(const byte *surface, int xs, int ys, int width, int height, int destX, int destY); void m_scroll16(const byte *surface, int xs, int ys, int width, int height, int destX, int destY); void m_scroll16A(const byte *surface, int xs, int ys, int width, int height, int destX, int destY); void Copy_Vga16(const byte *surface, int xp, int yp, int width, int height, int destX, int destY); diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 827b548bf0..efb1ce24fb 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -4493,7 +4493,7 @@ void HopkinsEngine::playIntro() { _globals.BPP_NOAFF = false; _globals.iRegul = 1; _graphicsManager.FADE_INW(); - if (_graphicsManager.DOUBLE_ECRAN) { + if (_graphicsManager._largeScreenFl) { _graphicsManager.no_scroll = 2; bool v3 = false; _graphicsManager.SCROLL = 0; @@ -4549,9 +4549,6 @@ void HopkinsEngine::playIntro() { _eventsManager.VBL(); memcpy(&paletteData2, _graphicsManager._palette, 796); - // CHECKME: Useless variables? - // v21 = *(uint16 *)&_graphicsManager.Palette[796]; - // v22 = _graphicsManager.Palette[798]; _graphicsManager.setpal_vga256_linux(paletteData, _graphicsManager._vesaBuffer); _graphicsManager.FIN_VISU(); diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 8c01f53364..818f8c6535 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -382,8 +382,8 @@ void ObjectsManager::displaySprite() { } } - AFF_BOB_ANIM(); - AFF_VBOB(); + displayBobAnim(); + displayVBob(); if (!PERSO_ON) { // Handle drawing characters on the screen @@ -698,39 +698,32 @@ void ObjectsManager::SCBOB(int idx) { for (int v8 = 0; v8 <= 20; v8++) { if ((_vm->_globals._bob[v8].field0) && (!_vm->_globals._bob[v8]._disabledAnimationFl) && (!_vm->_globals._bob[v8].field34) && (_vm->_globals._bob[v8]._frameIndex != 250)) { - int v2 = _vm->_globals._bob[v8]._oldWidth; int v9 = _vm->_globals._bob[v8]._oldX + _vm->_globals._bob[v8]._oldWidth; int v6 = _vm->_globals._bob[v8]._oldY + _vm->_globals._bob[v8]._oldHeight; - int v3 =_vm->_globals.Cache[idx]._x; - int v4 =_vm->_globals.Cache[idx]._y; - int v7 =_vm->_globals.Cache[idx]._width + v3; - int v1 =_vm->_globals.Cache[idx].field14 +_vm->_globals.Cache[idx]._height + v4; - - if ((v6 > v4) && (v6 < v1)) { - v1 = 0; - if (v9 >= v3 && v9 <= (_vm->_globals.Cache[idx]._width + v3)) { + int v7 = _vm->_globals.Cache[idx]._width + _vm->_globals.Cache[idx]._x; + + if ((v6 > _vm->_globals.Cache[idx]._y) && (v6 < _vm->_globals.Cache[idx].field14 +_vm->_globals.Cache[idx]._height + _vm->_globals.Cache[idx]._y)) { + bool checkFl = false; + if (v9 >= _vm->_globals.Cache[idx]._x && v9 <= v7) { ++_vm->_globals.Cache[idx].fieldA; - v1 = 1; + checkFl = true; } - if (!(uint16)v1) { - if (v2 >= v3 && v7 >= v2) { - ++_vm->_globals.Cache[idx].fieldA; - v1 = 1; - } + if (!checkFl && v7 >= _vm->_globals._bob[v8]._oldWidth && _vm->_globals._bob[v8]._oldWidth >= _vm->_globals.Cache[idx]._x) { + ++_vm->_globals.Cache[idx].fieldA; + checkFl = true; } - if (!(uint16)v1) { - if ( v7 >= v2 && v2 >= v3 ) { - ++_vm->_globals.Cache[idx].fieldA; - v1 = 1; - } + + if (!checkFl && v7 >= _vm->_globals._bob[v8]._oldWidth && _vm->_globals._bob[v8]._oldWidth >= _vm->_globals.Cache[idx]._x ) { + ++_vm->_globals.Cache[idx].fieldA; + checkFl = true; } - if (!(uint16)v1) { - if (v2 >= v3 && v9 <= v7) { - ++_vm->_globals.Cache[idx].fieldA; - v1 = 1; - } + + if (!checkFl && _vm->_globals._bob[v8]._oldWidth >= _vm->_globals.Cache[idx]._x && v9 <= v7) { + ++_vm->_globals.Cache[idx].fieldA; + checkFl = true; } - if (!(uint16)v1 && v2 <= v3 && v9 >= v7) + + if (!checkFl && _vm->_globals._bob[v8]._oldWidth <= _vm->_globals.Cache[idx]._x && v9 >= v7) ++_vm->_globals.Cache[idx].fieldA; } } @@ -748,69 +741,58 @@ void ObjectsManager::CALCUL_BOB(int idx) { if (result == 250) return; - int v5, v15, v22; + int deltaY, deltaX; if (_vm->_globals._bob[idx]._modeFlag) { - v22 = v15 = getOffsetX(_vm->_globals._bob[idx]._spriteData, result, 1); - v5 = getOffsetY(_vm->_globals._bob[idx]._spriteData, _vm->_globals._bob[idx]._frameIndex, 1); + deltaX = getOffsetX(_vm->_globals._bob[idx]._spriteData, result, 1); + deltaY = getOffsetY(_vm->_globals._bob[idx]._spriteData, _vm->_globals._bob[idx]._frameIndex, 1); } else { - v22 = v15 = getOffsetX(_vm->_globals._bob[idx]._spriteData, result, 0); - v5 = getOffsetY(_vm->_globals._bob[idx]._spriteData, _vm->_globals._bob[idx]._frameIndex, 0); + deltaX = getOffsetX(_vm->_globals._bob[idx]._spriteData, result, 0); + deltaY = getOffsetY(_vm->_globals._bob[idx]._spriteData, _vm->_globals._bob[idx]._frameIndex, 0); } - int v17 = v5; - int v6 = v5; int v20 = 0; - int v7 = _vm->_globals._bob[idx].field36; - - if (v7 < 0) { - v7 = -v7; - v20 = v7; - if (v7 > 95) - v20 = 95; - } - int v21 = 0; - if (_vm->_globals._bob[idx].field36 > 0) + if (_vm->_globals._bob[idx].field36 < 0) { + v20 = -_vm->_globals._bob[idx].field36; + if (v20 > 95) + v20 = 95; + } else v21 = _vm->_globals._bob[idx].field36; if (v21) { - if (v15 >= 0) { - v22 = _vm->_graphicsManager.zoomIn(v15, v21); - } else { - if (v15 < 0) - v15 = -v15; - v22 = -_vm->_graphicsManager.zoomIn(v15, v21); - } - if (v6 >= 0) { - v17 = _vm->_graphicsManager.zoomIn(v6, v21); + if (deltaX >= 0) + deltaX = _vm->_graphicsManager.zoomIn(deltaX, v21); + else + deltaX = -_vm->_graphicsManager.zoomIn(deltaX, v21); + + if (deltaY >= 0) { + deltaY = _vm->_graphicsManager.zoomIn(deltaY, v21); } else { - int v9 = v15; - if (v15 < 0) - v9 = -v15; - v6 = v9; - v17 = -_vm->_graphicsManager.zoomIn(v9, v21); + int deltaY = deltaX; + if (deltaX < 0) + deltaY = -deltaX; + deltaY = -_vm->_graphicsManager.zoomIn(deltaY, v21); } } if (v20) { - if (v15 >= 0) { - v22 = _vm->_graphicsManager.zoomOut(v15, v20); - } else { - v15 = -v15; - v22 = -_vm->_graphicsManager.zoomOut(v15, v20); - } - if (v6 >= 0) { - v17 = _vm->_graphicsManager.zoomOut(v6, v20); + if (deltaX >= 0) + deltaX = _vm->_graphicsManager.zoomOut(deltaX, v20); + else + deltaX = -_vm->_graphicsManager.zoomOut(-deltaX, v20); + + if (deltaY >= 0) { + deltaY = _vm->_graphicsManager.zoomOut(deltaY, v20); } else { - int v11 = v15; - if (v15 < 0) - v11 = -v15; - v17 = -_vm->_graphicsManager.zoomOut(v11, v20); + if (deltaX < 0) + deltaY = -_vm->_graphicsManager.zoomOut(-deltaX, v20); + else + deltaY = -_vm->_graphicsManager.zoomOut(deltaX, v20); } } - int v13 = _vm->_globals._bob[idx]._xp - v22; - int v14 = _vm->_globals._bob[idx]._yp - v17; + int v13 = _vm->_globals._bob[idx]._xp - deltaX; + int v14 = _vm->_globals._bob[idx]._yp - deltaY; _vm->_globals._bob[idx]._activeFl = true; _vm->_globals._bob[idx]._oldX = v13; _vm->_globals._bob[idx]._oldY = v14; @@ -840,78 +822,59 @@ void ObjectsManager::CALCUL_BOB(int idx) { } void ObjectsManager::VERIFCACHE() { - int v1; - int v2; - int v3; - int v4; - int v5; - int v6; - int v7; - int v9; - int v11; - for (int v8 = 0; v8 <= 19; v8++) { - if (_vm->_globals.Cache[v8].fieldA > 0) { - v7 = _vm->_globals.Cache[v8].fieldA; - for (int v10 = 0; v10 <= 4; v10++) { - if (_sprite[v10]._animationType == 1) { - if (_sprite[v10]._spriteIndex != 250) { - v1 = _sprite[v10].field2C; - v11 = _sprite[v10]._width + v1; - v2 = _sprite[v10]._height + _sprite[v10].field2E; - v6 = _vm->_globals.Cache[v8]._x; - v3 = _vm->_globals.Cache[v8]._y; - v9 = _vm->_globals.Cache[v8]._width + v6; - - if (v2 > v3) { - if (v2 < (_vm->_globals.Cache[v8].field14 + _vm->_globals.Cache[v8]._height + v3)) { - v4 = 0; - if (v11 >= v6 && v11 <= v9) { - ++_vm->_globals.Cache[v8].fieldA; - v4 = 1; - } - if (!v4) { - if (v6 <= v1 && v9 >= v1) { - ++_vm->_globals.Cache[v8].fieldA; - v4 = 1; - } - if (!v4) { - if (v9 >= v1 && v6 <= v1) { - ++_vm->_globals.Cache[v8].fieldA; - v4 = 1; - } - if (!v4) { - if (v6 <= v1 && v11 <= v9) { - ++_vm->_globals.Cache[v8].fieldA; - v4 = 1; - } - if (!v4 && v6 >= v1 && v11 >= v9) - ++_vm->_globals.Cache[v8].fieldA; - } - } - } - } - } + if (_vm->_globals.Cache[v8].fieldA <= 0) + continue; + + int oldFieldA = _vm->_globals.Cache[v8].fieldA; + for (int v10 = 0; v10 <= 4; v10++) { + if (_sprite[v10]._animationType == 1 && _sprite[v10]._spriteIndex != 250) { + int v11 = _sprite[v10]._width + _sprite[v10].field2C; + int v2 = _sprite[v10]._height + _sprite[v10].field2E; + int v9 = _vm->_globals.Cache[v8]._width + _vm->_globals.Cache[v8]._x; + + if (v2 > _vm->_globals.Cache[v8]._y && v2 < (_vm->_globals.Cache[v8].field14 + _vm->_globals.Cache[v8]._height + _vm->_globals.Cache[v8]._y)) { + bool v4 = false; + if (v11 >= _vm->_globals.Cache[v8]._x && v11 <= v9) { + ++_vm->_globals.Cache[v8].fieldA; + v4 = true; + } + + if (!v4 && v9 >= _sprite[v10].field2C && _vm->_globals.Cache[v8]._x <= _sprite[v10].field2C) { + ++_vm->_globals.Cache[v8].fieldA; + v4 = true; } - } - } - SCBOB(v8); - if (_vm->_globals.Cache[v8].fieldA == v7) { - if (_vm->_globals.Cache[v8].field10) { - _vm->_globals.Cache[v8].field10 = false; - _vm->_globals.Cache[v8].fieldA = 1; + if (!v4 && v9 >= _sprite[v10].field2C && _vm->_globals.Cache[v8]._x <= _sprite[v10].field2C) { + ++_vm->_globals.Cache[v8].fieldA; + v4 = true; + } + + if (!v4 && _vm->_globals.Cache[v8]._x <= _sprite[v10].field2C && v11 <= v9) { + ++_vm->_globals.Cache[v8].fieldA; + v4 = true; + } + + if (!v4 && _vm->_globals.Cache[v8]._x >= _sprite[v10].field2C && v11 >= v9) + ++_vm->_globals.Cache[v8].fieldA; } - } else { - v5 = _vm->_globals.Cache[v8].field14 + _vm->_globals.Cache[v8]._height + - _vm->_globals.Cache[v8]._y; - if (v5 > 440) - v5 = 500; + } + } - AvantTri(TRI_CACHE, v8, v5); + SCBOB(v8); + if (_vm->_globals.Cache[v8].fieldA == oldFieldA) { + if (_vm->_globals.Cache[v8].field10) { + _vm->_globals.Cache[v8].field10 = false; _vm->_globals.Cache[v8].fieldA = 1; - _vm->_globals.Cache[v8].field10 = true; } + } else { + int v5 = _vm->_globals.Cache[v8].field14 + _vm->_globals.Cache[v8]._height + _vm->_globals.Cache[v8]._y; + if (v5 > 440) + v5 = 500; + + AvantTri(TRI_CACHE, v8, v5); + _vm->_globals.Cache[v8].fieldA = 1; + _vm->_globals.Cache[v8].field10 = true; } } } @@ -1072,14 +1035,13 @@ int ObjectsManager::AvantTri(TriMode triMode, int index, int priority) { } // Display BOB Anim -void ObjectsManager::AFF_BOB_ANIM() { +void ObjectsManager::displayBobAnim() { int v1; int v5; uint v6; int v10; int v11; int v14; - int v19; byte *v20; byte *v21; int v24; @@ -1194,56 +1156,55 @@ void ObjectsManager::AFF_BOB_ANIM() { BOBTOUS = false; - for (int v27 = 1; v27 < 35; v27++) { - if (v27 > 20 || !PERSO_ON) { - if ((_vm->_globals._bob[v27].field0 == 10) && (_vm->_globals._bob[v27].field1C)) { - v14 = _vm->_globals._bob[v27].field1E; + for (int i = 1; i < 35; i++) { + if (i > 20 || !PERSO_ON) { + if ((_vm->_globals._bob[i].field0 == 10) && (_vm->_globals._bob[i].field1C)) { + v14 = _vm->_globals._bob[i].field1E; if ((v14 != 2) && (v14 != 4)) { - if (_vm->_globals.Liste2[v27]._visibleFl) { + if (_vm->_globals.Liste2[i]._visibleFl) { _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, - _vm->_globals.Liste2[v27]._xp, _vm->_globals.Liste2[v27]._yp, - _vm->_globals.Liste2[v27]._width, _vm->_globals.Liste2[v27]._height, - _vm->_graphicsManager._vesaBuffer, _vm->_globals.Liste2[v27]._xp, - _vm->_globals.Liste2[v27]._yp); - _vm->_globals.Liste2[v27]._visibleFl = false; + _vm->_globals.Liste2[i]._xp, _vm->_globals.Liste2[i]._yp, + _vm->_globals.Liste2[i]._width, _vm->_globals.Liste2[i]._height, + _vm->_graphicsManager._vesaBuffer, _vm->_globals.Liste2[i]._xp, + _vm->_globals.Liste2[i]._yp); + _vm->_globals.Liste2[i]._visibleFl = false; } } } - if (_vm->_globals._bob[v27].field0 == 11) { - if (_vm->_globals.Liste2[v27]._visibleFl) { + if (_vm->_globals._bob[i].field0 == 11) { + if (_vm->_globals.Liste2[i]._visibleFl) { _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, - _vm->_globals.Liste2[v27]._xp, _vm->_globals.Liste2[v27]._yp, - _vm->_globals.Liste2[v27]._width, _vm->_globals.Liste2[v27]._height, + _vm->_globals.Liste2[i]._xp, _vm->_globals.Liste2[i]._yp, + _vm->_globals.Liste2[i]._width, _vm->_globals.Liste2[i]._height, _vm->_graphicsManager._vesaBuffer, - _vm->_globals.Liste2[v27]._xp, _vm->_globals.Liste2[v27]._yp); - _vm->_globals.Liste2[v27]._visibleFl = false; + _vm->_globals.Liste2[i]._xp, _vm->_globals.Liste2[i]._yp); + _vm->_globals.Liste2[i]._visibleFl = false; } - _vm->_globals._bob[v27].field0 = 0; + _vm->_globals._bob[i].field0 = 0; } } } - for (int v28 = 1; v28 < 25; v28++) { - _vm->_globals._bob[v28]._oldY = 0; - if (_vm->_globals._bob[v28].field0 == 10 && !_vm->_globals._bob[v28]._disabledAnimationFl && _vm->_globals._bob[v28].field1C) { - CALCUL_BOB(v28); - int v = _vm->_globals._bob[v28]._oldHeight + _vm->_globals._bob[v28]._oldY; - v19 = _vm->_globals._bob[v28]._oldX2 + v; + for (int i = 1; i < 25; i++) { + _vm->_globals._bob[i]._oldY = 0; + if (_vm->_globals._bob[i].field0 == 10 && !_vm->_globals._bob[i]._disabledAnimationFl && _vm->_globals._bob[i].field1C) { + CALCUL_BOB(i); + int v19 = _vm->_globals._bob[i]._oldX2 + _vm->_globals._bob[i]._oldHeight + _vm->_globals._bob[i]._oldY; if (v19 > 450) v19 = 600; - if (_vm->_globals._bob[v28]._activeFl) - AvantTri(TRI_BOB, v28, v19); + if (_vm->_globals._bob[i]._activeFl) + AvantTri(TRI_BOB, i, v19); } } } // Display VBOB -void ObjectsManager::AFF_VBOB() { +void ObjectsManager::displayVBob() { int width, height; for (int idx = 0; idx <= 29; idx++) { @@ -1362,10 +1323,6 @@ int ObjectsManager::getSpriteY(int idx) { return _sprite[idx]._spritePos.y; } -void ObjectsManager::SPRITE_NOW(const byte *spriteData, int a2, int a3, int a4, int a5, int a6, int a7, int a8) { - _vm->_graphicsManager.Affiche_Perfect(_vm->_graphicsManager._vesaBuffer, spriteData, a2, a3, a5, a6, a7, a8); -} - /** * Clear sprite structure */ @@ -2653,7 +2610,7 @@ void ObjectsManager::PARADISE() { if (result && _vm->_globals._saveData->data[svField2] && result != 4 && result > 3) { _vm->_fontManager.hideText(5); if (!_vm->_globals._forestFl || ((uint16)(NUMZONE - 20) > 1u && (uint16)(NUMZONE - 22) > 1u)) { - if (_vm->_graphicsManager.DOUBLE_ECRAN) { + if (_vm->_graphicsManager._largeScreenFl) { _vm->_graphicsManager.no_scroll = 2; if (_vm->_eventsManager._startPos.x >= getSpriteX(0) - 320) goto LABEL_64; @@ -4082,13 +4039,7 @@ void ObjectsManager::ACTION_DOS(int idx) { if (idx == 3) SPACTION1(_vm->_globals.GESTE, "12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8); if (idx == 4) - ACTION( - _vm->_globals.GESTE, - "0,1,2,3,4,5,6,7,8,8,8,8,8,8,9,10,11,12,13,12,11,12,13,12,11,12,13,12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", - 0, - 0, - 8, - 0); + ACTION(_vm->_globals.GESTE, "0,1,2,3,4,5,6,7,8,8,8,8,8,8,9,10,11,12,13,12,11,12,13,12,11,12,13,12,11,10,9,8,7,6,5,4,3,2,1,0,-1,", 0, 0, 8, 0); if (idx == 5) SPACTION(_vm->_globals.GESTE, "15,16,17,18,19,20,21,-1,", 0, 0, 8, 0); if (idx == 6) @@ -4816,10 +4767,10 @@ int ObjectsManager::colision(int xp, int yp) { int16 *dataP = _vm->_linesManager._zoneLine[field2].zoneData; if (dataP != (int16 *)g_PTRNUL) { int count = _vm->_linesManager._zoneLine[field2].count; - int v1 = *dataP; - int v2 = *(dataP + 1); - int v3 = *(dataP + count * 2 - 2); - int v4 = *(dataP + count * 2 - 1); + int v1 = dataP[0]; + int v2 = dataP[1]; + int v3 = dataP[count * 2 - 2]; + int v4 = dataP[count * 2 - 1]; bool flag = true; if (v1 < v3 && (xMax < v1 || xMin > v3)) @@ -5253,7 +5204,7 @@ void ObjectsManager::PERSONAGE2(const Common::String &backgroundFile, const Comm break; } _vm->_eventsManager.setMouseXY(_characterPos); - if (_vm->_graphicsManager.DOUBLE_ECRAN) + if (_vm->_graphicsManager._largeScreenFl) _vm->_graphicsManager.SCROLL = (int16)getSpriteX(0) - 320; VERIFTAILLE(); SPRITE_ON(0); diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 7394bb6cac..7f50a20232 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -156,13 +156,11 @@ public: void DEF_CACHE(int idx); void computeSprite(int idx); int AvantTri(TriMode triMode, int index, int priority); - void AFF_BOB_ANIM(); - void AFF_VBOB(); + void displayBobAnim(); + void displayVBob(); int getSpriteX(int idx); int getSpriteY(int idx); - void SPRITE_NOW(const byte *spriteData, int a2, int a3, int a4, int a5, int a6, int a7, int a8); - void clearSprite(); void SPRITE_ON(int idx); void SPRITE(const byte *spriteData, Common::Point pos, int idx, int spriteIndex, int a6, int a7, int a8, int a9); diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 7ec1804bd8..e1e0ac70b6 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -49,7 +49,7 @@ int ScriptManager::handleOpcode(byte *dataP) { int opcodeType = 0; int v70 = 0; if (dataP[2] == 'T' && dataP[3] == 'X' && dataP[4] == 'T') { - v70 = *(dataP + 6); + v70 = dataP[6]; byte v2 = dataP[7]; byte v69 = dataP[8]; int v67 = (int16)READ_LE_UINT16(dataP + 9); @@ -165,9 +165,9 @@ int ScriptManager::handleOpcode(byte *dataP) { } } else if (dataP[2] == 'B' && dataP[3] == 'O' && dataP[4] == 'B') { if (!_vm->_objectsManager._disableFl) { - int v72 = *(dataP + 5); - v70 = *(dataP + 6); - int v4 = *(dataP + 7); + int v72 = dataP[5]; + v70 = dataP[6]; + int v4 = dataP[7]; int v68 = (int16)READ_LE_UINT16(dataP + 8); int v66 = (int16)READ_LE_UINT16(dataP + 10); if (v72 == 52) { @@ -175,22 +175,20 @@ int ScriptManager::handleOpcode(byte *dataP) { } else if (v72 == 51) { _vm->_objectsManager.BOB_VIVANT(v70); } else { - if (v72 == 50) - goto LABEL_1141; - _vm->_objectsManager.VBOB(_vm->_globals.SPRITE_ECRAN, v72, v68, v66, v70); - if (v4) - v4 /= _vm->_globals._speed; - if (v4 > 1) { - do { - if (_vm->shouldQuit()) - return -1; // Exiting game - - --v4; - _vm->_eventsManager.VBL(); - } while (v4); - } - if (v72 == 50) -LABEL_1141: + if (v72 != 50) { + _vm->_objectsManager.VBOB(_vm->_globals.SPRITE_ECRAN, v72, v68, v66, v70); + if (v4) + v4 /= _vm->_globals._speed; + if (v4 > 1) { + do { + if (_vm->shouldQuit()) + return -1; // Exiting game + + --v4; + _vm->_eventsManager.VBL(); + } while (v4); + } + } else _vm->_objectsManager.AFFICHE_SPEED1(_vm->_globals.SPRITE_ECRAN, v68, v66, v70); } } @@ -198,7 +196,7 @@ LABEL_1141: } else if (dataP[2] == 'S' && dataP[3] == 'T' && dataP[4] == 'P') { if (!_vm->_objectsManager._disableFl) { _vm->_objectsManager._twoCharactersFl = false; - int v5 = *(dataP + 5); + int v5 = dataP[5]; int v6 = (int16)READ_LE_UINT16(dataP + 8); _vm->_objectsManager._characterPos.x = (int16)READ_LE_UINT16(dataP + 6); _vm->_objectsManager._characterPos.y = v6; @@ -258,10 +256,10 @@ LABEL_1141: _vm->_objectsManager.CH_TETE = false; } else if (dataP[2] == 'S' && dataP[3] == 'T' && dataP[4] == 'E') { if (!_vm->_objectsManager._disableFl) { - int v7 = *(dataP + 5); - v70 = *(dataP + 6); - int v8 = *(dataP + 7); - int v9 = *(dataP + 8); + int v7 = dataP[5]; + v70 = dataP[6]; + int v8 = dataP[7]; + int v9 = dataP[8]; _vm->_objectsManager.RECALL = 0; _vm->_globals._prevScreenId = _vm->_globals._screenId; _vm->_globals._saveData->data[svField6] = _vm->_globals._screenId; @@ -2427,7 +2425,7 @@ LABEL_1141: _vm->_globals._saveData->data[(int16)READ_LE_UINT16(dataP + 5)] = (int16)READ_LE_UINT16(dataP + 7); } else if (dataP[2] == 'A' && dataP[3] == 'D' && dataP[4] == 'D') { opcodeType = 1; - _vm->_globals._saveData->data[(int16)READ_LE_UINT16(dataP + 5)] += *(dataP + 7); + _vm->_globals._saveData->data[(int16)READ_LE_UINT16(dataP + 5)] += dataP[7]; } else if (dataP[2] == 'B' && dataP[3] == 'O' && dataP[4] == 'S') { opcodeType = 1; _vm->_objectsManager.BOB_OFFSET((int16)READ_LE_UINT16(dataP + 5), (int16)READ_LE_UINT16(dataP + 7)); diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index dee18f050d..b2ead64e87 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -50,12 +50,6 @@ void TalkManager::setParent(HopkinsEngine *vm) { } void TalkManager::PARLER_PERSO(const Common::String &filename) { - int v5; - int v7; - byte *v8; - byte *v9; - byte *v10; - int v14; Common::String spriteFilename; int answer = 0; @@ -109,10 +103,11 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { PLIGNE2 = PLIGNE1 + 1; PLIGNE3 = PLIGNE1 + 2; PLIGNE4 = PLIGNE1 + 3; - v14 = _vm->_eventsManager._mouseCursorId; + int v14 = _vm->_eventsManager._mouseCursorId; _vm->_eventsManager._mouseCursorId = 4; _vm->_eventsManager.changeMouseCursor(0); if (!_vm->_globals.NOPARLE) { + int v5; do { v5 = DIALOGUE(); if (v5 != PLIGNE4) @@ -124,6 +119,7 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { } if (_vm->_globals.NOPARLE) { int v6 = 1; + int v7; do v7 = DIALOGUE_REP(v6++); while (v7 != -1); @@ -153,15 +149,7 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) { _vm->_graphicsManager.lockScreen(); _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaScreen, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); _vm->_graphicsManager.unlockScreen(); - v8 = _vm->_graphicsManager._vesaBuffer; - v9 = _vm->_graphicsManager._vesaScreen; - memcpy(_vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager._vesaScreen, 614396); - v9 = v9 + 614396; - v8 = v8 + 614396; - *v8 = *v9; - v8 += 2; - *v8 = *(v9 + 2); - v10 = v8 + 1; + memcpy(_vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager._vesaScreen, 614399); _vm->_globals._disableInventFl = oldDisableInventFl; _vm->_graphicsManager.DD_VBL(); for (int i = 0; i <= 4; i++) @@ -651,24 +639,24 @@ int TalkManager::VERIF_BOITE(int idx, const Common::String &file, int a3) { for (;;) { v17 = v10; do { - v11 = *(ptr + v9 + v10); + v11 = ptr[v9 + v10]; v14 = v11; ++v10; - } while (v11 != 32 && v11 != 37); + } while (v11 != ' ' && v11 != '%'); if (v10 >= v15 / _vm->_globals.police_l) break; - if (v11 == 37) { + if (v11 == '%') { if (v10 < v15 / _vm->_globals.police_l) goto LABEL_31; break; } } - if (v11 != 37) + if (v11 != '%') goto LABEL_33; - v14 = 32; + v14 = ' '; LABEL_31: - if (v14 == 37) + if (v14 == '%') v17 = v10; LABEL_33: ++v18; @@ -929,7 +917,7 @@ LABEL_2: v11 = 0; do { assert(v11 < 20); - *(v11++ + v8) = v6[v7++]; + v8[v11++] = v6[v7++]; if (v6[v7] == 'F' && v6[v7 + 1] == 'F') { v16 = 1; v8[v11] = 'F'; @@ -939,9 +927,7 @@ LABEL_2: } while (v16 != 1); } if (v16 != 1) { - if (v6[v7] == 'C' && v6[v7 + 1] == 'O' && v6[v7 + 2] == 'D') - loopCond = true; - if (v16 != 1 && v6[v7] == 'F' && v6[v7 + 1] == 'I' && v6[v7 + 2] == 'N') + if ((v6[v7] == 'C' && v6[v7 + 1] == 'O' && v6[v7 + 2] == 'D') || (v6[v7] == 'F' && v6[v7 + 1] == 'I' && v6[v7 + 2] == 'N')) loopCond = true; } v6 += v7 + 1; @@ -1086,8 +1072,6 @@ void TalkManager::REPONSE2(int a1, int a2) { void TalkManager::OBJET_VIVANT(const Common::String &a2) { int v5; byte *v11; - byte *v14; - byte *v15; Common::String s; Common::String v20; Common::String v22; @@ -1213,14 +1197,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) { _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaScreen, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); _vm->_graphicsManager.unlockScreen(); _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager._palette); - v14 = _vm->_graphicsManager._vesaBuffer; - v15 = _vm->_graphicsManager._vesaScreen; - memcpy(_vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager._vesaScreen, 614396); - v15 = v15 + 614396; - v14 = v14 + 614396; - WRITE_LE_UINT16(v14, (int16)READ_LE_UINT16(v15)); - v14 = v14 + 2; - *v14 = *(v15 + 2); + memcpy(_vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager._vesaScreen, 614399); _vm->_globals._disableInventFl = false; _vm->_graphicsManager.DD_VBL(); for (int i = 0; i <= 4; i++) |