diff options
author | Strangerke | 2013-03-26 08:11:53 +0100 |
---|---|---|
committer | Strangerke | 2013-03-26 08:13:14 +0100 |
commit | 02f939c28209122ed1b8bef3cbf98973afed4bee (patch) | |
tree | 5152f22520255412edd2f8707f5ae483609dcd93 /engines/hopkins | |
parent | 63b669cfc4ec0cae7be83949f98ee3fd48607f90 (diff) | |
download | scummvm-rg350-02f939c28209122ed1b8bef3cbf98973afed4bee.tar.gz scummvm-rg350-02f939c28209122ed1b8bef3cbf98973afed4bee.tar.bz2 scummvm-rg350-02f939c28209122ed1b8bef3cbf98973afed4bee.zip |
HOPKINS: Simplify some statements using MIN, MAX and CLIP
Diffstat (limited to 'engines/hopkins')
-rw-r--r-- | engines/hopkins/events.cpp | 5 | ||||
-rw-r--r-- | engines/hopkins/graphics.h | 9 | ||||
-rw-r--r-- | engines/hopkins/hopkins.cpp | 13 | ||||
-rw-r--r-- | engines/hopkins/lines.cpp | 12 |
4 files changed, 15 insertions, 24 deletions
diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index a73ce41a0b..0d5db1b39f 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -456,10 +456,7 @@ void EventsManager::refreshScreenAndEvents() { if (getMouseX() < _vm->_graphicsManager->_scrollPosX + 10) _vm->_graphicsManager->_scrollPosX -= _vm->_graphicsManager->_scrollSpeed; } - if (_vm->_graphicsManager->_scrollPosX < 0) - _vm->_graphicsManager->_scrollPosX = 0; - if (_vm->_graphicsManager->_scrollPosX > SCREEN_WIDTH) - _vm->_graphicsManager->_scrollPosX = SCREEN_WIDTH; + _vm->_graphicsManager->_scrollPosX = CLIP(_vm->_graphicsManager->_scrollPosX, 0, SCREEN_WIDTH); if (_vm->_graphicsManager->_oldScrollPosX == _vm->_graphicsManager->_scrollPosX) { _vm->_graphicsManager->displayDirtyRects(); } else { diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 64ea4266fa..1d02ce76ed 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -63,13 +63,15 @@ private: bool _clipFl; int _specialWidth; - byte SD_PIXELS[PALETTE_SIZE * 2]; int _enlargedX, _enlargedY; bool _enlargedXFl, _enlargedYFl; int clip_x1, clip_y1; int _reduceX, _reducedY; int _zoomOutFactor; + byte SD_PIXELS[PALETTE_SIZE * 2]; + bool MANU_SCROLL; + void loadScreen(const Common::String &file); void loadPCX640(byte *surface, const Common::String &file, byte *palette, bool typeFlag); void loadPCX320(byte *surface, const Common::String &file, byte *palette); @@ -77,10 +79,10 @@ private: void fadeOut(const byte *palette, int step, const byte *surface); void changePalette(const byte *palette); uint16 mapRGB(byte r, byte g, byte b); + void copy16bFromSurfaceScaleX2(const byte *surface); void Trans_bloc(byte *destP, const byte *srcP, int count, int minThreshold, int maxThreshold); void Copy_Vga16(const byte *surface, int xp, int yp, int width, int height, int destX, int destY); - void copy16bFromSurfaceScaleX2(const byte *surface); public: int _lineNbr; byte _colorTable[PALETTE_EXT_BLOCK_SIZE]; @@ -113,7 +115,6 @@ public: int WinScan; byte *PAL_PIXELS; - bool MANU_SCROLL; int FADE_LINUX; public: GraphicsManager(HopkinsEngine *vm); @@ -165,13 +166,13 @@ public: void endDisplayBob(); void updateScreen(); void reduceScreenPart(const byte *srcSruface, byte *destSurface, int xp, int yp, int width, int height, int zoom); + void setScreenWidth(int pitch); void SETCOLOR3(int palIndex, int r, int g, int b); void SETCOLOR4(int palIndex, int r, int g, int b); void AFFICHE_SPEEDVGA(const byte *objectData, int xp, int yp, int idx, bool addSegment = true); void Affiche_Perfect(byte *surface, const byte *srcData, int xp300, int yp300, int frameIndex, int zoom1, int zoom2, bool flipFl); void Copy_Mem(const byte *srcSurface, int x1, int y1, uint16 width, int height, byte *destSurface, int destX, int destY); - void setScreenWidth(int pitch); void Sprite_Vesa(byte *surface, const byte *spriteData, int xp, int yp, int spriteIndex); 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); diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 4051e5acf8..95d16aaffc 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -2457,14 +2457,11 @@ void HopkinsEngine::displayCredits(int startPosY, byte *buffer, char color) { _globals->_creditsStartY = startPosY; _globals->_creditsEndY = endPosY; } - if (startPosX < _globals->_creditsStartX) - _globals->_creditsStartX = startPosX; - if (endPosX > _globals->_creditsEndX) - _globals->_creditsEndX = endPosX; - if (_globals->_creditsStartY > startPosY) - _globals->_creditsStartY = startPosY; - if (endPosY > _globals->_creditsEndY) - _globals->_creditsEndY = endPosY; + + _globals->_creditsStartX = MIN(_globals->_creditsStartX, startPosX); + _globals->_creditsEndX = MAX(_globals->_creditsEndX, endPosX); + _globals->_creditsStartY = MIN(_globals->_creditsStartY, startPosY); + _globals->_creditsEndY = MAX(_globals->_creditsEndY, endPosY); Common::String message = Common::String((char *)buffer); _fontManager->displayText(startPosX, startPosY, message, color); diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index e0f0d844a4..52a17b10e2 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -2698,14 +2698,10 @@ void LinesManager::CARRE_ZONE() { int zoneX = *dataP++; int zoneY = *dataP++; - if (curZone->_left >= zoneX) - curZone->_left = zoneX; - if (curZone->_right <= zoneX) - curZone->_right = zoneX; - if (curZone->_top >= zoneY) - curZone->_top = zoneY; - if (curZone->_bottom <= zoneY) - curZone->_bottom = zoneY; + curZone->_left = MIN(curZone->_left, zoneX); + curZone->_right = MAX(curZone->_right, zoneX); + curZone->_top = MIN(curZone->_top, zoneY); + curZone->_bottom = MAX(curZone->_bottom, zoneY); } } |