From 3878138d8f290fc42fa45b80f9a9b03e824d7584 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 20 Jan 2013 11:28:39 +0100 Subject: HOPKINS: Some renaming in GraphicsManager and HopkinsEngine --- engines/hopkins/anim.cpp | 10 +- engines/hopkins/computer.cpp | 12 +-- engines/hopkins/events.cpp | 62 ++++++------ engines/hopkins/graphics.cpp | 222 +++++++++++++++++++++---------------------- engines/hopkins/graphics.h | 19 ++-- engines/hopkins/hopkins.cpp | 30 +++--- engines/hopkins/hopkins.h | 4 +- engines/hopkins/lines.cpp | 42 ++++---- engines/hopkins/objects.cpp | 88 ++++++++--------- 9 files changed, 241 insertions(+), 248 deletions(-) (limited to 'engines/hopkins') diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index e6e9985fcc..a9932ab65b 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -262,7 +262,7 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint _vm->_graphicsManager.lockScreen(); _vm->_graphicsManager.clearScreen(); _vm->_graphicsManager.unlockScreen(); - _vm->_graphicsManager.max_x = SCREEN_WIDTH; + _vm->_graphicsManager._maxX = SCREEN_WIDTH; if (_vm->_graphicsManager.WinScan / 2 > SCREEN_WIDTH) { hasScreenCopy = true; screenCopy = _vm->_globals.allocMemory(307200); @@ -313,12 +313,12 @@ void AnimationManager::playAnim2(const Common::String &filename, uint32 a2, uint _vm->_graphicsManager.scrollScreen(oldScrollVal); if (_vm->_graphicsManager._largeScreenFl) { _vm->_graphicsManager.SCANLINE(1280); - _vm->_graphicsManager.max_x = 1280; + _vm->_graphicsManager._maxX = 1280; _vm->_graphicsManager.lockScreen(); _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaBuffer, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } else { _vm->_graphicsManager.SCANLINE(SCREEN_WIDTH * 2); - _vm->_graphicsManager.max_x = SCREEN_WIDTH; + _vm->_graphicsManager._maxX = SCREEN_WIDTH; _vm->_graphicsManager.lockScreen(); _vm->_graphicsManager.clearScreen(); _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaBuffer, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); @@ -443,12 +443,12 @@ LABEL_114: _vm->_graphicsManager.scrollScreen(oldScrollVal); if (_vm->_graphicsManager._largeScreenFl) { _vm->_graphicsManager.SCANLINE(1280); - _vm->_graphicsManager.max_x = 1280; + _vm->_graphicsManager._maxX = 1280; _vm->_graphicsManager.lockScreen(); _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaBuffer, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } else { _vm->_graphicsManager.SCANLINE(SCREEN_WIDTH); - _vm->_graphicsManager.max_x = SCREEN_WIDTH; + _vm->_graphicsManager._maxX = SCREEN_WIDTH; _vm->_graphicsManager.lockScreen(); _vm->_graphicsManager.clearScreen(); _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaBuffer, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index ef56575567..9420e82b9f 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -521,9 +521,9 @@ void ComputerManager::displayGamesSubMenu() { _ballRightFl = false; _ballUpFl = false; _breakoutLevelNbr = 0; - _vm->_graphicsManager.min_y = 0; - _vm->_graphicsManager.max_x = 320; - _vm->_graphicsManager.max_y = 200; + _vm->_graphicsManager._minY = 0; + _vm->_graphicsManager._maxX = 320; + _vm->_graphicsManager._maxY = 200; _vm->_soundManager.loadSample(1, "SOUND37.WAV"); _vm->_soundManager.loadSample(2, "SOUND38.WAV"); _vm->_soundManager.loadSample(3, "SOUND39.WAV"); @@ -546,9 +546,9 @@ void ComputerManager::displayGamesSubMenu() { setVideoMode(); setTextColor(15); clearScreen(); - _vm->_graphicsManager.max_x = 680; - _vm->_graphicsManager.min_y = 0; - _vm->_graphicsManager.max_y = 460; + _vm->_graphicsManager._maxX = 680; + _vm->_graphicsManager._minY = 0; + _vm->_graphicsManager._maxY = 460; } /** diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index d2c0689f0a..6fd46ec82d 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -340,26 +340,26 @@ void EventsManager::VBL() { goto LABEL_35; } if (_breakoutFl) { - if (v15 < _vm->_graphicsManager.min_x) - v15 = _vm->_graphicsManager.min_x; - if (_mousePos.y < _vm->_graphicsManager.min_y) - yp = _vm->_graphicsManager.min_y; - if (_mouseSizeX + v15 >= _vm->_graphicsManager.max_x) - v14 = _mouseSizeX - (_mouseSizeX + v15 - _vm->_graphicsManager.max_x); - if (yp + _mouseSizeY < _vm->_graphicsManager.max_y) + if (v15 < _vm->_graphicsManager._minX) + v15 = _vm->_graphicsManager._minX; + if (_mousePos.y < _vm->_graphicsManager._minY) + yp = _vm->_graphicsManager._minY; + if (_mouseSizeX + v15 >= _vm->_graphicsManager._maxX) + v14 = _mouseSizeX - (_mouseSizeX + v15 - _vm->_graphicsManager._maxX); + if (yp + _mouseSizeY < _vm->_graphicsManager._maxY) goto LABEL_34; - v3 = yp + _mouseSizeY - _vm->_graphicsManager.max_y; + v3 = yp + _mouseSizeY - _vm->_graphicsManager._maxY; } else { - if (v15 < _vm->_graphicsManager.min_x) - v15 = _vm->_graphicsManager.min_x - v1; + if (v15 < _vm->_graphicsManager._minX) + v15 = _vm->_graphicsManager._minX - v1; v2 = (int16)v2; - if (_mousePos.y < _vm->_graphicsManager.min_y - (int16)v2) - yp = _vm->_graphicsManager.min_y - (int16)v2; - if (_mouseSizeX + v15 >= _vm->_graphicsManager.max_x) - v14 = _mouseSizeX - (_mouseSizeX + v15 - _vm->_graphicsManager.max_x - v1); - if (yp + _mouseSizeY < v2 + _vm->_graphicsManager.max_y) + if (_mousePos.y < _vm->_graphicsManager._minY - (int16)v2) + yp = _vm->_graphicsManager._minY - (int16)v2; + if (_mouseSizeX + v15 >= _vm->_graphicsManager._maxX) + v14 = _mouseSizeX - (_mouseSizeX + v15 - _vm->_graphicsManager._maxX - v1); + if (yp + _mouseSizeY < v2 + _vm->_graphicsManager._maxY) goto LABEL_34; - v3 = v2 + yp + _mouseSizeY - _vm->_graphicsManager.max_y; + v3 = v2 + yp + _mouseSizeY - _vm->_graphicsManager._maxY; } v13 = _mouseSizeY - v3; LABEL_34: @@ -375,15 +375,15 @@ LABEL_35: } if (_mouseCursorId == 23) goto LABEL_45; - if (yp >= _vm->_graphicsManager.max_y || v15 >= _vm->_graphicsManager.max_x || v14 <= 1 || v13 <= 1) { + if (yp >= _vm->_graphicsManager._maxY || v15 >= _vm->_graphicsManager._maxX || v14 <= 1 || v13 <= 1) { if (_mouseCursorId != 23) goto LABEL_54; LABEL_45: - if (yp < _vm->_graphicsManager.max_y && v15 < _vm->_graphicsManager.max_x) { - if ((signed int)(v14 + v15) > _vm->_graphicsManager.max_x) - v14 -= v14 + v15 - _vm->_graphicsManager.max_x; - if (yp + v13 > _vm->_graphicsManager.max_y) - v13 -= yp + v13 - _vm->_graphicsManager.max_y; + if (yp < _vm->_graphicsManager._maxY && v15 < _vm->_graphicsManager._maxX) { + if ((signed int)(v14 + v15) > _vm->_graphicsManager._maxX) + v14 -= v14 + v15 - _vm->_graphicsManager._maxX; + if (yp + v13 > _vm->_graphicsManager._maxY) + v13 -= yp + v13 - _vm->_graphicsManager._maxY; if (v14 > 1 && v13 > 1) { _vm->_eventsManager.updateCursor(); } @@ -462,11 +462,11 @@ LABEL_65: void EventsManager::updateCursor() { // Backup the current sprite clipping bounds and reset them - Common::Rect clipBounds(_vm->_graphicsManager.min_x, _vm->_graphicsManager.min_y, - _vm->_graphicsManager.max_x, _vm->_graphicsManager.max_y); - _vm->_graphicsManager.min_x = _vm->_graphicsManager.min_y = 0; - _vm->_graphicsManager.max_x = _vm->_globals._objectWidth; - _vm->_graphicsManager.max_y = _vm->_globals._objectHeight; + Common::Rect clipBounds(_vm->_graphicsManager._minX, _vm->_graphicsManager._minY, + _vm->_graphicsManager._maxX, _vm->_graphicsManager._maxY); + _vm->_graphicsManager._minX = _vm->_graphicsManager._minY = 0; + _vm->_graphicsManager._maxX = _vm->_globals._objectWidth; + _vm->_graphicsManager._maxY = _vm->_globals._objectHeight; int pitch = _vm->_graphicsManager._lineNbr2; _vm->_graphicsManager._lineNbr2 = _vm->_globals._objectWidth; @@ -483,10 +483,10 @@ void EventsManager::updateCursor() { } // Reset the clipping bounds - _vm->_graphicsManager.min_x = clipBounds.left; - _vm->_graphicsManager.min_y = clipBounds.top; - _vm->_graphicsManager.max_x = clipBounds.right; - _vm->_graphicsManager.max_y = clipBounds.bottom; + _vm->_graphicsManager._minX = clipBounds.left; + _vm->_graphicsManager._minY = clipBounds.top; + _vm->_graphicsManager._maxX = clipBounds.right; + _vm->_graphicsManager._maxY = clipBounds.bottom; _vm->_graphicsManager._lineNbr2 = pitch; // Convert the cursor to the pixel format. At the moment, it's hardcoded diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 3ad8d95061..8e54bc1cfb 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -35,8 +35,8 @@ namespace Hopkins { GraphicsManager::GraphicsManager() { _lockCounter = 0; - SDL_MODEYES = false; - XSCREEN = YSCREEN = 0; + _initGraphicsFl = false; + _screenWidth = _screenHeight = 0; WinScan = 0; PAL_PIXELS = NULL; _lineNbr = 0; @@ -53,17 +53,16 @@ GraphicsManager::GraphicsManager() { FADE_LINUX = 0; _skipVideoLockFl = false; _scrollStatus = 0; - min_x = 0; - min_y = 20; - max_x = SCREEN_WIDTH * 2; - max_y = SCREEN_HEIGHT - 20; - clip_x = clip_y = 0; + _minX = 0; + _minY = 20; + _maxX = SCREEN_WIDTH * 2; + _maxY = SCREEN_HEIGHT - 20; + _posXClipped = _posYClipped = 0; clip_x1 = clip_y1 = 0; - clip_flag = false; + _clipFl = false; Red_x = Red_y = 0; Red = 0; _width = 0; - Compteur_y = 0; spec_largeur = 0; Common::fill(&SD_PIXELS[0], &SD_PIXELS[PALETTE_SIZE * 2], 0); @@ -94,7 +93,7 @@ void GraphicsManager::setParent(HopkinsEngine *vm) { } void GraphicsManager::setGraphicalMode(int width, int height) { - if (!SDL_MODEYES) { + if (!_initGraphicsFl) { Graphics::PixelFormat pixelFormat16(2, 5, 6, 5, 0, 11, 5, 0, 0); initGraphics(width, height, true, &pixelFormat16); @@ -103,17 +102,17 @@ void GraphicsManager::setGraphicalMode(int width, int height) { _vesaBuffer = _vm->_globals.allocMemory(SCREEN_WIDTH * 2 * SCREEN_HEIGHT); _videoPtr = NULL; - XSCREEN = width; - YSCREEN = height; + _screenWidth = width; + _screenHeight = height; WinScan = width * 2; // Refactor me PAL_PIXELS = SD_PIXELS; _lineNbr = width; - SDL_MODEYES = true; + _initGraphicsFl = true; } else { - error("Called SET_MODE multiple times"); + error("setGraphicalMode called multiple times"); } } @@ -143,7 +142,7 @@ void GraphicsManager::unlockScreen() { */ void GraphicsManager::clearScreen() { assert(_videoPtr); - _videoPtr->fillRect(Common::Rect(0, 0, XSCREEN, YSCREEN), 0); + _videoPtr->fillRect(Common::Rect(0, 0, _screenWidth, _screenHeight), 0); } /** @@ -163,10 +162,10 @@ void GraphicsManager::loadVgaImage(const Common::String &file) { lockScreen(); clearScreen(); unlockScreen(); - A_PCX320(_vesaScreen, file, _palette); + loadPCX320(_vesaScreen, file, _palette); memcpy(_vesaBuffer, _vesaScreen, 64000); SCANLINE(320); - max_x = 320; + _maxX = 320; lockScreen(); copy16bFromSurfaceScaleX2(_vesaBuffer); @@ -192,7 +191,7 @@ void GraphicsManager::loadScreen(const Common::String &file) { } scrollScreen(0); - A_PCX640_480(_vesaScreen, file, _palette, flag); + loadPCX640(_vesaScreen, file, _palette, flag); _scrollPosX = 0; _oldScrollPosX = 0; @@ -200,14 +199,14 @@ void GraphicsManager::loadScreen(const Common::String &file) { if (!_largeScreenFl) { SCANLINE(SCREEN_WIDTH); - max_x = SCREEN_WIDTH; + _maxX = SCREEN_WIDTH; lockScreen(); clearScreen(); m_scroll16(_vesaScreen, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); unlockScreen(); } else { SCANLINE(SCREEN_WIDTH * 2); - max_x = SCREEN_WIDTH * 2; + _maxX = SCREEN_WIDTH * 2; lockScreen(); clearScreen(); unlockScreen(); @@ -290,7 +289,7 @@ void GraphicsManager::Trans_bloc2(byte *surface, byte *col, int size) { } } -void GraphicsManager::A_PCX640_480(byte *surface, const Common::String &file, byte *palette, bool typeFlag) { +void GraphicsManager::loadPCX640(byte *surface, const Common::String &file, byte *palette, bool typeFlag) { Common::File f; Graphics::PCXDecoder pcxDecoder; @@ -325,7 +324,7 @@ void GraphicsManager::A_PCX640_480(byte *surface, const Common::String &file, by f.close(); } -void GraphicsManager::A_PCX320(byte *surface, const Common::String &file, byte *palette) { +void GraphicsManager::loadPCX320(byte *surface, const Common::String &file, byte *palette) { size_t filesize; int v4; size_t v5; @@ -898,7 +897,6 @@ void GraphicsManager::Capture_Mem(const byte *srcSurface, byte *destSurface, int const byte *srcP; byte *destP; int rowCount; - int i; int rowCount2; // TODO: This code in the original is potentially dangerous, as it doesn't clip the area to within @@ -913,7 +911,7 @@ void GraphicsManager::Capture_Mem(const byte *srcSurface, byte *destSurface, int srcP += width; destP += width; } else if (width & 2) { - for (i = width >> 1; i; --i) { + for (int i = width >> 1; i; --i) { destP[0] = srcP[0]; destP[1] = srcP[1]; srcP += 2; @@ -935,9 +933,9 @@ void GraphicsManager::Sprite_Vesa(byte *surface, const byte *spriteData, int xp, for (int i = spriteIndex; i; --i) spriteP += READ_LE_UINT32(spriteP) + 16; - clip_x = 0; - clip_y = 0; - clip_flag = false; + _posXClipped = 0; + _posYClipped = 0; + _clipFl = false; spriteP += 4; int width = READ_LE_UINT16(spriteP); @@ -946,44 +944,44 @@ void GraphicsManager::Sprite_Vesa(byte *surface, const byte *spriteData, int xp, // Clip X clip_x1 = width; - if ((xp + width) <= (min_x + 300)) + if ((xp + width) <= (_minX + 300)) return; - if (xp < (min_x + 300)) { - clip_x = min_x + 300 - xp; - clip_flag = true; + if (xp < (_minX + 300)) { + _posXClipped = _minX + 300 - xp; + _clipFl = true; } // Clip Y // TODO: This is weird, but it's that way in the original. Original game bug? if ((yp + height) <= height) return; - if (yp < (min_y + 300)) { - clip_y = min_y + 300 - yp; - clip_flag = true; + if (yp < (_minY + 300)) { + _posYClipped = _minY + 300 - yp; + _clipFl = true; } // Clip X1 - if (xp >= (max_x + 300)) + if (xp >= (_maxX + 300)) return; - if ((xp + width) > (max_x + 300)) { - int xAmount = width + 10 - (xp + width - (max_x + 300)); + if ((xp + width) > (_maxX + 300)) { + int xAmount = width + 10 - (xp + width - (_maxX + 300)); if (xAmount <= 10) return; clip_x1 = xAmount - 10; - clip_flag = true; + _clipFl = true; } // Clip Y1 - if (yp >= (max_y + 300)) + if (yp >= (_maxY + 300)) return; - if ((yp + height) > (max_y + 300)) { - int yAmount = height + 10 - (yp + height - (max_y + 300)); + if ((yp + height) > (_maxY + 300)) { + int yAmount = height + 10 - (yp + height - (_maxY + 300)); if (yAmount <= 10) return; clip_y1 = yAmount - 10; - clip_flag = true; + _clipFl = true; } // Sprite display @@ -999,7 +997,7 @@ void GraphicsManager::Sprite_Vesa(byte *surface, const byte *spriteData, int xp, byte *destP = surface + (yp - 300) * _lineNbr2 + (xp - 300); // Handling for clipped versus non-clipped - if (clip_flag) { + if (_clipFl) { // Clipped version for (int yc = 0; yc < height; ++yc, destP += _lineNbr2) { byte *tempDestP = destP; @@ -1014,7 +1012,7 @@ void GraphicsManager::Sprite_Vesa(byte *surface, const byte *spriteData, int xp, if (byteVal == 254) { // Copy pixel range for (int xv = 0; xv < width; ++xv, ++xc, ++spriteP, ++tempDestP) { - if (clip_y == 0 && xc >= clip_x && xc < clip_x1) + if (_posYClipped == 0 && xc >= _posXClipped && xc < clip_x1) *tempDestP = *spriteP; } } else { @@ -1024,8 +1022,8 @@ void GraphicsManager::Sprite_Vesa(byte *surface, const byte *spriteData, int xp, } } - if (clip_y > 0) - --clip_y; + if (_posYClipped > 0) + --_posYClipped; srcP += 3; } } else { @@ -1100,14 +1098,14 @@ void GraphicsManager::addVesaSegment(int x1, int y1, int x2, int y2) { tempX = x1; addFlag = true; - if (x2 > max_x) - x2 = max_x; - if (y2 > max_y) - y2 = max_y; - if (x1 < min_x) - tempX = min_x; - if (y1 < min_y) - y1 = min_y; + if (x2 > _maxX) + x2 = _maxX; + if (y2 > _maxY) + y2 = _maxY; + if (x1 < _minX) + tempX = _minX; + if (y1 < _minY) + y1 = _minY; if (_vm->_globals.NBBLOC > 1) { int16 blocIndex = 0; @@ -1293,24 +1291,23 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp int spriteHeight2 = (int16)READ_LE_UINT16(spriteSizeP); int spriteHeight1 = spriteHeight2; spritePixelsP = spriteSizeP + 10; - clip_x = 0; - clip_y = 0; + _posXClipped = 0; + _posYClipped = 0; clip_x1 = 0; clip_y1 = 0; - if ((xp300 <= min_x) || (yp300 <= min_y) || (xp300 >= max_x + 300) || (yp300 >= max_y + 300)) + if ((xp300 <= _minX) || (yp300 <= _minY) || (xp300 >= _maxX + 300) || (yp300 >= _maxY + 300)) return; - if ((uint16)xp300 < (uint16)(min_x + 300)) - clip_x = min_x + 300 - xp300; + if ((uint16)xp300 < (uint16)(_minX + 300)) + _posXClipped = _minX + 300 - xp300; - if ((uint16)yp300 < (uint16)(min_y + 300)) - clip_y = min_y + 300 - yp300; + if ((uint16)yp300 < (uint16)(_minY + 300)) + _posYClipped = _minY + 300 - yp300; - clip_x1 = max_x + 300 - xp300; - clip_y1 = max_y + 300 - yp300; + clip_x1 = _maxX + 300 - xp300; + clip_y1 = _maxY + 300 - yp300; dest1P = xp300 + _lineNbr2 * (yp300 - 300) - 300 + surface; if (zoom2) { - Compteur_y = 0; Agr_x = 0; Agr_y = 0; Agr_Flag_y = false; @@ -1320,22 +1317,22 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp int v22 = zoomIn(spriteHeight1, zoom2); if (modeFlag) { v29 = v20 + dest1P; - if (clip_y) { - if ((uint16)clip_y >= v22) + if (_posYClipped) { + if ((uint16)_posYClipped >= v22) return; int v30 = 0; - while (zoomIn(++v30, zoom2) < (uint16)clip_y) + while (zoomIn(++v30, zoom2) < (uint16)_posYClipped) ; spritePixelsP += _width * v30; - v29 += _lineNbr2 * (uint16)clip_y; - v22 = v22 - (uint16)clip_y; + v29 += _lineNbr2 * (uint16)_posYClipped; + v22 = v22 - (uint16)_posYClipped; } if (v22 > (uint16)clip_y1) v22 = (uint16)clip_y1; - if (clip_x) { - if ((uint16)clip_x >= v20) + if (_posXClipped) { + if ((uint16)_posXClipped >= v20) return; - v20 -= (uint16)clip_x; + v20 -= (uint16)_posXClipped; } if (v20 > (uint16)clip_x1) { int v32 = v20 - (uint16)clip_x1; @@ -1377,7 +1374,6 @@ void GraphicsManager::Affiche_Perfect(byte *surface, const byte *srcData, int xp R_Aff_Zoom_Larg_Cont1: spritePixelsP = _width + v46; v29 = _lineNbr2 + v53; - ++Compteur_y; if (!Agr_Flag_y) Agr_y = zoom2 + Agr_y; if ((uint16)Agr_y < 100) @@ -1393,31 +1389,31 @@ R_Aff_Zoom_Larg_Cont1: v22 = v63 - 1; } while (v63 != 1); } else { - if (clip_y) { - if ((uint16)clip_y >= v22) + if (_posYClipped) { + if ((uint16)_posYClipped >= v22) return; int v58 = v22; int v49 = v20; int v23 = 0; - int v24 = (uint16)clip_y; + int v24 = (uint16)_posYClipped; while (zoomIn(++v23, zoom2) < v24) ; v20 = v49; spritePixelsP += _width * v23; - dest1P += _lineNbr2 * (uint16)clip_y; - v22 = v58 - (uint16)clip_y; + dest1P += _lineNbr2 * (uint16)_posYClipped; + v22 = v58 - (uint16)_posYClipped; } if (v22 > (uint16)clip_y1) v22 = (uint16)clip_y1; - if (clip_x) { - if ((uint16)clip_x >= v20) + if (_posXClipped) { + if ((uint16)_posXClipped >= v20) return; int v26 = 0; - while (zoomIn(++v26, zoom2) < (uint16)clip_x) + while (zoomIn(++v26, zoom2) < (uint16)_posXClipped) ; spritePixelsP += v26; - dest1P += (uint16)clip_x; - v20 = v20 - (uint16)clip_x; + dest1P += (uint16)_posXClipped; + v20 = v20 - (uint16)_posXClipped; } if (v20 > (uint16)clip_x1) v20 = (uint16)clip_x1; @@ -1470,7 +1466,6 @@ Aff_Zoom_Larg_Cont1: } while (v60 != 1); } } else if (zoom1) { - Compteur_y = 0; Red_x = 0; Red_y = 0; _width = spriteWidth; @@ -1489,7 +1484,7 @@ Aff_Zoom_Larg_Cont1: for (int v41 = _width; v41; v41--) { Red_x = Red + Red_x; if ((uint16)Red_x < 100) { - if (v42 >= clip_x && v42 < clip_x1 && *spritePixelsP) + if (v42 >= _posXClipped && v42 < clip_x1 && *spritePixelsP) *v40 = *spritePixelsP; --v40; ++spritePixelsP; @@ -1518,7 +1513,7 @@ Aff_Zoom_Larg_Cont1: for (int v38 = _width; v38; v38--) { Red_x = Red + Red_x; if ((uint16)Red_x < 100) { - if (v39 >= clip_x && v39 < clip_x1 && *spritePixelsP) + if (v39 >= _posXClipped && v39 < clip_x1 && *spritePixelsP) *dest1P = *spritePixelsP; ++dest1P; ++spritePixelsP; @@ -1540,22 +1535,21 @@ Aff_Zoom_Larg_Cont1: } } else { _width = spriteWidth; - Compteur_y = 0; if (modeFlag) { dest2P = spriteWidth + dest1P; spec_largeur = spriteWidth; - if (clip_y) { - if ((uint16)clip_y >= (unsigned int)spriteHeight1) + if (_posYClipped) { + if ((uint16)_posYClipped >= (unsigned int)spriteHeight1) return; - spritePixelsP += spriteWidth * (uint16)clip_y; - dest2P += _lineNbr2 * (uint16)clip_y; - spriteHeight1 -= (uint16)clip_y; + spritePixelsP += spriteWidth * (uint16)_posYClipped; + dest2P += _lineNbr2 * (uint16)_posYClipped; + spriteHeight1 -= (uint16)_posYClipped; } int xLeft = (uint16)clip_y1; if (spriteHeight1 > clip_y1) spriteHeight1 = clip_y1; - xLeft = clip_x; - if (clip_x) { + xLeft = _posXClipped; + if (_posXClipped) { if (xLeft >= spriteWidth) return; spriteWidth -= xLeft; @@ -1583,21 +1577,21 @@ Aff_Zoom_Larg_Cont1: } while (yCtr2 != 1); } else { spec_largeur = spriteWidth; - if (clip_y) { - if ((uint16)clip_y >= (unsigned int)spriteHeight1) + if (_posYClipped) { + if ((uint16)_posYClipped >= (unsigned int)spriteHeight1) return; - spritePixelsP += spriteWidth * (uint16)clip_y; - dest1P += _lineNbr2 * (uint16)clip_y; - spriteHeight1 -= (uint16)clip_y; + spritePixelsP += spriteWidth * (uint16)_posYClipped; + dest1P += _lineNbr2 * (uint16)_posYClipped; + spriteHeight1 -= (uint16)_posYClipped; } if (spriteHeight1 > clip_y1) spriteHeight1 = clip_y1; - if (clip_x) { - if ((uint16)clip_x >= spriteWidth) + if (_posXClipped) { + if ((uint16)_posXClipped >= spriteWidth) return; - spritePixelsP += (uint16)clip_x; - dest1P += (uint16)clip_x; - spriteWidth -= (uint16)clip_x; + spritePixelsP += (uint16)_posXClipped; + dest1P += (uint16)_posXClipped; + spriteWidth -= (uint16)_posXClipped; } if (spriteWidth > (uint16)clip_x1) spriteWidth = (uint16)clip_x1; @@ -1651,20 +1645,20 @@ void GraphicsManager::SCOPY(const byte *surface, int x1, int y1, int width, int croppedWidth = width; croppedHeight = height; - if (x1 < min_x) { - croppedWidth = width - (min_x - x1); - left = min_x; + if (x1 < _minX) { + croppedWidth = width - (_minX - x1); + left = _minX; } - if (y1 < min_y) { - croppedHeight = height - (min_y - y1); - top = min_y; + if (y1 < _minY) { + croppedHeight = height - (_minY - y1); + top = _minY; } top2 = top; - if (top + croppedHeight > max_y) - croppedHeight = max_y - top; + if (top + croppedHeight > _maxY) + croppedHeight = _maxY - top; xRight = left + croppedWidth; - if (xRight > max_x) - croppedWidth = max_x - left; + if (xRight > _maxX) + croppedWidth = _maxX - left; if (croppedWidth > 0 && croppedHeight > 0) { int height2 = croppedHeight; diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 264a3fad80..2c601492e5 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -54,9 +54,9 @@ private: void loadScreen(const Common::String &file); public: int _lockCounter; - bool SDL_MODEYES; - int XSCREEN; - int YSCREEN; + bool _initGraphicsFl; + int _screenWidth; + int _screenHeight; int WinScan; byte SD_PIXELS[PALETTE_SIZE * 2]; byte *PAL_PIXELS; @@ -81,15 +81,14 @@ public: bool _skipVideoLockFl; int _scrollStatus; Common::Rect dstrect[50]; - int min_x, min_y; - int max_x, max_y; - int clip_x, clip_y; + int _minX, _minY; + int _maxX, _maxY; + int _posXClipped, _posYClipped; int clip_x1, clip_y1; - bool clip_flag; + bool _clipFl; int Red_x, Red_y; int Red; int _width; - int Compteur_y; int spec_largeur; bool _noFadingFl; public: @@ -107,8 +106,8 @@ public: void scrollScreen(int amount); void Trans_bloc(byte *destP, const byte *srcP, int count, int minThreshold, int maxThreshold); void Trans_bloc2(byte *surface, byte *col, int size); - void A_PCX640_480(byte *surface, const Common::String &file, byte *palette, bool typeFlag); - void A_PCX320(byte *surface, const Common::String &file, byte *palette); + void loadPCX640(byte *surface, const Common::String &file, byte *palette, bool typeFlag); + void loadPCX320(byte *surface, const Common::String &file, byte *palette); void clearPalette(); void SCANLINE(int pitch); void m_scroll16(const byte *surface, int xs, int ys, int width, int height, int destX, int destY); diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 2dc5211793..42916448ac 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -333,7 +333,7 @@ bool HopkinsEngine::runWin95Demo() { case 13: case 14: case 15: - NO_DISPO(11); + handleNotAvailable(11); break; case 16: @@ -348,11 +348,11 @@ bool HopkinsEngine::runWin95Demo() { case 33: case 32: case 34: - NO_DISPO(4); + handleNotAvailable(4); break; case 17: - NO_DISPO(1); + handleNotAvailable(1); break; case 111: @@ -512,7 +512,7 @@ bool HopkinsEngine::runLinuxDemo() { case 32: case 34: case 38: - PASS(); + displayNotAvailable(); break; case 1: @@ -1953,7 +1953,7 @@ void HopkinsEngine::playIntro() { /** * If in demo, displays a 'not available' screen and returns to the city map */ -void HopkinsEngine::PASS() { +void HopkinsEngine::displayNotAvailable() { if (!getIsDemo()) return; @@ -1972,10 +1972,10 @@ void HopkinsEngine::PASS() { _globals._exitId = 4; } -void HopkinsEngine::NO_DISPO(int sortie) { +void HopkinsEngine::handleNotAvailable(int sortie) { // Use the code of the linux demo instead of the code of the Windows demo. // The behavior is somewhat better, and common code is easier to maintain. - PASS(); + displayNotAvailable(); _globals._exitId = sortie; } @@ -2921,10 +2921,10 @@ bool HopkinsEngine::displayAdultDisclaimer() { int xp, yp; int buttonIndex; - _graphicsManager.min_x = 0; - _graphicsManager.min_y = 0; - _graphicsManager.max_x = SCREEN_WIDTH; - _graphicsManager.max_y = SCREEN_HEIGHT - 1; + _graphicsManager._minX = 0; + _graphicsManager._minY = 0; + _graphicsManager._maxX = SCREEN_WIDTH; + _graphicsManager._maxY = SCREEN_HEIGHT - 1; _eventsManager._breakoutFl = false; _globals._forestFl = false; _globals._disableInventFl = true; @@ -2958,10 +2958,10 @@ bool HopkinsEngine::displayAdultDisclaimer() { return false; } else { // Continue - _graphicsManager.min_x = 0; - _graphicsManager.max_y = 20; - _graphicsManager.max_x = SCREEN_WIDTH; - _graphicsManager.max_y = SCREEN_HEIGHT - 20; + _graphicsManager._minX = 0; + _graphicsManager._maxY = 20; + _graphicsManager._maxX = SCREEN_WIDTH; + _graphicsManager._maxY = SCREEN_HEIGHT - 20; return true; } } diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 9b1bce5509..8ae9093872 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -84,7 +84,7 @@ private: void initializeSystem(); - void PASS(); + void displayNotAvailable(); void restoreSystem(); void PUBQUIT(); void displayEndDemo(); @@ -106,7 +106,7 @@ private: void loadCredits(); void displayCredits(int startPosY, byte *buffer, char colour); void displayCredits(); - void NO_DISPO(int sortie); + void handleNotAvailable(int sortie); bool runWin95Demo(); bool runLinuxDemo(); diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index c9434e9e2f..07fbc16d64 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -422,8 +422,8 @@ void LinesManager::initRoute() { int curLineX = curLineData[2 * curDataIdx - 2]; int curLineY = curLineData[2 * curDataIdx - 1]; - if (_vm->_graphicsManager.max_x == curLineX || _vm->_graphicsManager.max_y == curLineY || - _vm->_graphicsManager.min_x == curLineX || _vm->_graphicsManager.min_y == curLineY || + if (_vm->_graphicsManager._maxX == curLineX || _vm->_graphicsManager._maxY == curLineY || + _vm->_graphicsManager._minX == curLineX || _vm->_graphicsManager._minY == curLineY || (lineX == curLineX && lineY == curLineY)) break; if (lineIdx == MAX_LINES) @@ -1143,7 +1143,7 @@ LABEL_17: v74 = v100; - if (_vm->_graphicsManager.max_x <= v36 || v67 <= v36) + if (_vm->_graphicsManager._maxX <= v36 || v67 <= v36) break; } int v37 = a5; @@ -1393,8 +1393,8 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { clipDestX = 20; if (clipDestY <= 19) clipDestY = 20; - if (clipDestX > _vm->_graphicsManager.max_x - 10) - clipDestX = _vm->_graphicsManager.max_x - 10; + if (clipDestX > _vm->_graphicsManager._maxX - 10) + clipDestX = _vm->_graphicsManager._maxX - 10; if (clipDestY > _vm->_globals.Max_Perso_Y) clipDestY = _vm->_globals.Max_Perso_Y; @@ -1412,7 +1412,7 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { if (PARC_PERS(srcX, srcY, clipDestX, clipDestY, -1, -1, 0) != 1) { v14 = 0; v15 = clipDestY; - if (_vm->_graphicsManager.max_y > clipDestY) { + if (_vm->_graphicsManager._maxY > clipDestY) { v16 = 5; do { v101 = v16; @@ -1423,12 +1423,12 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { v141[v101] = -1; ++v14; ++v15; - } while (_vm->_graphicsManager.max_y > v15); + } while (_vm->_graphicsManager._maxY > v15); } v131[5] = v14; v18 = 0; v19 = clipDestY; - if (_vm->_graphicsManager.min_y < clipDestY) { + if (_vm->_graphicsManager._minY < clipDestY) { v20 = 1; do { v102 = v20; @@ -1443,12 +1443,12 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { } ++v18; --v19; - } while (_vm->_graphicsManager.min_y < v19); + } while (_vm->_graphicsManager._minY < v19); } v131[1] = v18; v22 = 0; v23 = clipDestX; - if (_vm->_graphicsManager.max_x > clipDestX) { + if (_vm->_graphicsManager._maxX > clipDestX) { v24 = 3; do { v103 = v24; @@ -1465,12 +1465,12 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { if (v131[5] < v22 && v141[5] != -1) break; ++v23; - } while (_vm->_graphicsManager.max_x > v23); + } while (_vm->_graphicsManager._maxX > v23); } v131[3] = v22; v26 = 0; v27 = clipDestX; - if (_vm->_graphicsManager.min_x < clipDestX) { + if (_vm->_graphicsManager._minX < clipDestX) { v28 = 7; do { v104 = v28; @@ -1489,7 +1489,7 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { if (v131[3] < v26 && v141[3] != -1) break; --v27; - } while (_vm->_graphicsManager.min_x < v27); + } while (_vm->_graphicsManager._minX < v27); } v131[7] = v26; if (v141[1] < 0 || _vm->_objectsManager._lastLine < v141[1]) @@ -1540,7 +1540,7 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { v34 = 0; v35 = srcY; - if (_vm->_graphicsManager.max_y > srcY) { + if (_vm->_graphicsManager._maxY > srcY) { v36 = 5; do { v105 = v36; @@ -1551,12 +1551,12 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { v141[v105] = -1; ++v34; ++v35; - } while (_vm->_graphicsManager.max_y > v35); + } while (_vm->_graphicsManager._maxY > v35); } v131[5] = v34 + 1; v38 = 0; v39 = srcY; - if (_vm->_graphicsManager.min_y < srcY) { + if (_vm->_graphicsManager._minY < srcY) { v40 = 1; do { v106 = v40; @@ -1571,12 +1571,12 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { break; } --v39; - } while (_vm->_graphicsManager.min_y < v39); + } while (_vm->_graphicsManager._minY < v39); } v131[1] = v38 + 1; v42 = 0; v43 = srcX; - if (_vm->_graphicsManager.max_x > srcX) { + if (_vm->_graphicsManager._maxX > srcX) { v44 = 3; do { v107 = v44; @@ -1591,12 +1591,12 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { break; } ++v43; - } while (_vm->_graphicsManager.max_x > v43); + } while (_vm->_graphicsManager._maxX > v43); } v131[3] = v42 + 1; v46 = 0; v47 = srcX; - if (_vm->_graphicsManager.min_x < srcX) { + if (_vm->_graphicsManager._minX < srcX) { v48 = 7; do { v108 = v48; @@ -1611,7 +1611,7 @@ int16 *LinesManager::PARCOURS2(int srcX, int srcY, int destX, int destY) { break; } --v47; - } while (_vm->_graphicsManager.min_x < v47); + } while (_vm->_graphicsManager._minX < v47); } v131[7] = v46 + 1; if (v141[1] != -1) { diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 36e124e14c..2ddf24c75c 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -276,12 +276,12 @@ void ObjectsManager::displaySprite() { if (_vm->_fontManager._textList[idx]._enabledFl && _vm->_fontManager._text[idx]._textType != 2) { clipX = _vm->_fontManager._textList[idx]._pos.x - 2; - if (clipX < _vm->_graphicsManager.min_x) - clipX = _vm->_graphicsManager.min_x; + if (clipX < _vm->_graphicsManager._minX) + clipX = _vm->_graphicsManager._minX; clipY = _vm->_fontManager._textList[idx]._pos.y - 2; - if (clipY < _vm->_graphicsManager.min_y) - clipY = _vm->_graphicsManager.min_y; + if (clipY < _vm->_graphicsManager._minY) + clipY = _vm->_graphicsManager._minY; _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, clipX, clipY, _vm->_fontManager._textList[idx]._width + 4, _vm->_fontManager._textList[idx]._height + 4, @@ -294,12 +294,12 @@ void ObjectsManager::displaySprite() { for (int idx = 0; idx < MAX_SPRITE; ++idx) { if (_vm->_globals.Liste[idx].field0) { clipX = _vm->_globals.Liste[idx].field2 - 2; - if (clipX < _vm->_graphicsManager.min_x) - clipX = _vm->_graphicsManager.min_x; + if (clipX < _vm->_graphicsManager._minX) + clipX = _vm->_graphicsManager._minX; clipY = _vm->_globals.Liste[idx].field4 - 2; - if (clipY < _vm->_graphicsManager.min_y) - clipY = _vm->_graphicsManager.min_y; + if (clipY < _vm->_graphicsManager._minY) + clipY = _vm->_graphicsManager._minY; _vm->_graphicsManager.SCOPY(_vm->_graphicsManager._vesaScreen, clipX, clipY, _vm->_globals.Liste[idx]._width + 4, _vm->_globals.Liste[idx]._height + 4, @@ -447,17 +447,17 @@ void ObjectsManager::displaySprite() { _vm->_fontManager._textList[idx]._width = _vm->_fontManager._text[idx]._width; _vm->_fontManager._textList[idx]._height = _vm->_fontManager._text[idx]._height; - if (_vm->_fontManager._textList[idx]._pos.x < _vm->_graphicsManager.min_x) - _vm->_fontManager._textList[idx]._pos.x = _vm->_graphicsManager.min_x - 1; - if (_vm->_fontManager._textList[idx]._pos.y < _vm->_graphicsManager.min_y) - _vm->_fontManager._textList[idx]._pos.y = _vm->_graphicsManager.min_y - 1; + if (_vm->_fontManager._textList[idx]._pos.x < _vm->_graphicsManager._minX) + _vm->_fontManager._textList[idx]._pos.x = _vm->_graphicsManager._minX - 1; + if (_vm->_fontManager._textList[idx]._pos.y < _vm->_graphicsManager._minY) + _vm->_fontManager._textList[idx]._pos.y = _vm->_graphicsManager._minY - 1; int posX = _vm->_fontManager._textList[idx]._pos.x; - if (_vm->_fontManager._textList[idx]._width + posX > _vm->_graphicsManager.max_x) - _vm->_fontManager._textList[idx]._width = _vm->_graphicsManager.max_x - posX; + if (_vm->_fontManager._textList[idx]._width + posX > _vm->_graphicsManager._maxX) + _vm->_fontManager._textList[idx]._width = _vm->_graphicsManager._maxX - posX; int posY = _vm->_fontManager._textList[idx]._pos.y; - if (_vm->_fontManager._textList[idx]._height + posY > _vm->_graphicsManager.max_y) - _vm->_fontManager._textList[idx]._height = _vm->_graphicsManager.max_y - posY; + if (_vm->_fontManager._textList[idx]._height + posY > _vm->_graphicsManager._maxY) + _vm->_fontManager._textList[idx]._height = _vm->_graphicsManager._maxY - posY; if (_vm->_fontManager._textList[idx]._width <= 0 || _vm->_fontManager._textList[idx]._height <= 0) _vm->_fontManager._textList[idx]._enabledFl = false; } @@ -526,21 +526,21 @@ void ObjectsManager::DEF_BOB(int idx) { _vm->_globals.Liste2[idx]._width = _vm->_globals._bob[idx]._oldWidth; _vm->_globals.Liste2[idx]._height = _vm->_globals._bob[idx]._oldHeight; - if (_vm->_globals.Liste2[idx]._xp < _vm->_graphicsManager.min_x) { - _vm->_globals.Liste2[idx]._width -= _vm->_graphicsManager.min_x - _vm->_globals.Liste2[idx]._xp; - _vm->_globals.Liste2[idx]._xp = _vm->_graphicsManager.min_x; + if (_vm->_globals.Liste2[idx]._xp < _vm->_graphicsManager._minX) { + _vm->_globals.Liste2[idx]._width -= _vm->_graphicsManager._minX - _vm->_globals.Liste2[idx]._xp; + _vm->_globals.Liste2[idx]._xp = _vm->_graphicsManager._minX; } - if (_vm->_globals.Liste2[idx]._yp < _vm->_graphicsManager.min_y) { - _vm->_globals.Liste2[idx]._height -= _vm->_graphicsManager.min_y - _vm->_globals.Liste2[idx]._yp; - _vm->_globals.Liste2[idx]._yp = _vm->_graphicsManager.min_y; + if (_vm->_globals.Liste2[idx]._yp < _vm->_graphicsManager._minY) { + _vm->_globals.Liste2[idx]._height -= _vm->_graphicsManager._minY - _vm->_globals.Liste2[idx]._yp; + _vm->_globals.Liste2[idx]._yp = _vm->_graphicsManager._minY; } - if (_vm->_globals.Liste2[idx]._width + _vm->_globals.Liste2[idx]._xp > _vm->_graphicsManager.max_x) - _vm->_globals.Liste2[idx]._width = _vm->_graphicsManager.max_x - _vm->_globals.Liste2[idx]._xp; + if (_vm->_globals.Liste2[idx]._width + _vm->_globals.Liste2[idx]._xp > _vm->_graphicsManager._maxX) + _vm->_globals.Liste2[idx]._width = _vm->_graphicsManager._maxX - _vm->_globals.Liste2[idx]._xp; - if (_vm->_globals.Liste2[idx]._height + _vm->_globals.Liste2[idx]._yp > _vm->_graphicsManager.max_y) - _vm->_globals.Liste2[idx]._height = _vm->_graphicsManager.max_y - _vm->_globals.Liste2[idx]._yp; + if (_vm->_globals.Liste2[idx]._height + _vm->_globals.Liste2[idx]._yp > _vm->_graphicsManager._maxY) + _vm->_globals.Liste2[idx]._height = _vm->_graphicsManager._maxY - _vm->_globals.Liste2[idx]._yp; if (_vm->_globals.Liste2[idx]._width <= 0 || _vm->_globals.Liste2[idx]._height <= 0) _vm->_globals.Liste2[idx]._visibleFl = false; @@ -774,21 +774,21 @@ void ObjectsManager::DEF_SPRITE(int idx) { _vm->_globals.Liste[idx]._width = _sprite[idx]._width; _vm->_globals.Liste[idx]._height = _sprite[idx]._height; - if (_vm->_globals.Liste[idx].field2 < _vm->_graphicsManager.min_x) { - _vm->_globals.Liste[idx]._width -= _vm->_graphicsManager.min_x - _vm->_globals.Liste[idx].field2; - _vm->_globals.Liste[idx].field2 = _vm->_graphicsManager.min_x; + if (_vm->_globals.Liste[idx].field2 < _vm->_graphicsManager._minX) { + _vm->_globals.Liste[idx]._width -= _vm->_graphicsManager._minX - _vm->_globals.Liste[idx].field2; + _vm->_globals.Liste[idx].field2 = _vm->_graphicsManager._minX; } - if (_vm->_globals.Liste[idx].field4 < _vm->_graphicsManager.min_y) { - _vm->_globals.Liste[idx]._height -= _vm->_graphicsManager.min_y - _vm->_globals.Liste[idx].field4; - _vm->_globals.Liste[idx].field4 = _vm->_graphicsManager.min_y; + if (_vm->_globals.Liste[idx].field4 < _vm->_graphicsManager._minY) { + _vm->_globals.Liste[idx]._height -= _vm->_graphicsManager._minY - _vm->_globals.Liste[idx].field4; + _vm->_globals.Liste[idx].field4 = _vm->_graphicsManager._minY; } - if (_vm->_globals.Liste[idx]._width + _vm->_globals.Liste[idx].field2 > _vm->_graphicsManager.max_x) - _vm->_globals.Liste[idx]._width = _vm->_graphicsManager.max_x - _vm->_globals.Liste[idx].field2; + if (_vm->_globals.Liste[idx]._width + _vm->_globals.Liste[idx].field2 > _vm->_graphicsManager._maxX) + _vm->_globals.Liste[idx]._width = _vm->_graphicsManager._maxX - _vm->_globals.Liste[idx].field2; - if (_vm->_globals.Liste[idx]._height + _vm->_globals.Liste[idx].field4 > _vm->_graphicsManager.max_y) - _vm->_globals.Liste[idx]._height = _vm->_graphicsManager.max_y - _vm->_globals.Liste[idx].field4; + if (_vm->_globals.Liste[idx]._height + _vm->_globals.Liste[idx].field4 > _vm->_graphicsManager._maxY) + _vm->_globals.Liste[idx]._height = _vm->_graphicsManager._maxY - _vm->_globals.Liste[idx].field4; if (_vm->_globals.Liste[idx]._width <= 0 || _vm->_globals.Liste[idx]._height <= 0) _vm->_globals.Liste[idx].field0 = false; @@ -2626,13 +2626,13 @@ int16 *ObjectsManager::cityMapCarRoute(int x1, int y1, int x2, int y2) { clipX2 = 15; if (y2 <= 14) clipY2 = 15; - if (clipX2 > _vm->_graphicsManager.max_x - 10) - clipX2 = _vm->_graphicsManager.max_x - 10; + if (clipX2 > _vm->_graphicsManager._maxX - 10) + clipX2 = _vm->_graphicsManager._maxX - 10; if (clipY2 > 445) clipY2 = 440; int delta = 0; - for (delta = 0; clipY2 + delta < _vm->_graphicsManager.max_y; delta++) { + for (delta = 0; clipY2 + delta < _vm->_graphicsManager._maxY; delta++) { if (_vm->_linesManager.checkCollisionLine(clipX2, clipY2 + delta, &arrDataIdx[5], &arrLineIdx[5], 0, _lastLine) && arrLineIdx[5] <= _lastLine) break; arrDataIdx[5] = 0; @@ -2640,7 +2640,7 @@ int16 *ObjectsManager::cityMapCarRoute(int x1, int y1, int x2, int y2) { } arrDelta[5] = delta; - for (delta = 0; clipY2 - delta > _vm->_graphicsManager.min_y; delta++) { + for (delta = 0; clipY2 - delta > _vm->_graphicsManager._minY; delta++) { if (_vm->_linesManager.checkCollisionLine(clipX2, clipY2 - delta , &arrDataIdx[1], &arrLineIdx[1], 0, _lastLine) && arrLineIdx[1] <= _lastLine) break; arrDataIdx[1] = 0; @@ -2650,7 +2650,7 @@ int16 *ObjectsManager::cityMapCarRoute(int x1, int y1, int x2, int y2) { } arrDelta[1] = delta; - for (delta = 0; clipX2 + delta < _vm->_graphicsManager.max_x; delta++) { + for (delta = 0; clipX2 + delta < _vm->_graphicsManager._maxX; delta++) { if (_vm->_linesManager.checkCollisionLine(clipX2 + delta, clipY2, &arrDataIdx[3], &arrLineIdx[3], 0, _lastLine) && arrLineIdx[3] <= _lastLine) break; arrDataIdx[3] = 0; @@ -2662,7 +2662,7 @@ int16 *ObjectsManager::cityMapCarRoute(int x1, int y1, int x2, int y2) { } arrDelta[3] = delta; - for (delta = 0; clipX2 - delta > _vm->_graphicsManager.min_x; delta++) { + for (delta = 0; clipX2 - delta > _vm->_graphicsManager._minX; delta++) { if (_vm->_linesManager.checkCollisionLine(clipX2 - delta, clipY2, &arrDataIdx[7], &arrLineIdx[7], 0, _lastLine) && arrLineIdx[7] <= _lastLine) break; arrDataIdx[7] = 0; @@ -3068,7 +3068,7 @@ int ObjectsManager::MZONE() { } int colRes2 = 0; - for (int j = yp; j < _vm->_graphicsManager.max_y; ++j) { + for (int j = yp; j < _vm->_graphicsManager._maxY; ++j) { colRes2 = colision(xp, j); if (colRes2 != -1 && _vm->_globals.ZONEP[colRes1].field10 == 1) break; @@ -3091,7 +3091,7 @@ int ObjectsManager::MZONE() { } int colRes4 = 0; - for (int xCurrent = xp; _vm->_graphicsManager.max_x > xCurrent; ++xCurrent) { + for (int xCurrent = xp; _vm->_graphicsManager._maxX > xCurrent; ++xCurrent) { colRes4 = colision(xCurrent, yp); if (colRes4 != -1 && _vm->_globals.ZONEP[colRes1].field10 == 1) break; -- cgit v1.2.3