diff options
author | lukaslw | 2014-07-22 02:10:32 +0200 |
---|---|---|
committer | lukaslw | 2014-07-22 02:10:32 +0200 |
commit | 819ca0636ff9644088837cc9f0a1049277bbfddd (patch) | |
tree | a7b366e17a3ea14ff2f9609d3745cd39ba469f8d | |
parent | 0415b81811ad28c2e135b97b96545073b5d8f6b2 (diff) | |
download | scummvm-rg350-819ca0636ff9644088837cc9f0a1049277bbfddd.tar.gz scummvm-rg350-819ca0636ff9644088837cc9f0a1049277bbfddd.tar.bz2 scummvm-rg350-819ca0636ff9644088837cc9f0a1049277bbfddd.zip |
PRINCE: approxPath(), plotTraceLine() clean up
-rw-r--r-- | engines/prince/prince.cpp | 60 | ||||
-rw-r--r-- | engines/prince/prince.h | 3 |
2 files changed, 26 insertions, 37 deletions
diff --git a/engines/prince/prince.cpp b/engines/prince/prince.cpp index 362a10654f..db72e01223 100644 --- a/engines/prince/prince.cpp +++ b/engines/prince/prince.cpp @@ -2934,8 +2934,6 @@ void PrinceEngine::plotTraceLine(int x, int y, int color, void *data) { traceLine->_traceLineLen++; traceLine->_traceLineFlag = 0; } else { - //mov eax, OldX // last correct point - //mov ebx, OldY traceLine->_traceLineFlag = -1; } } else { @@ -3866,50 +3864,42 @@ void PrinceEngine::plotTracePoint(int x, int y, int color, void *data) { } void PrinceEngine::approxPath() { - byte *oldCoords; // like in TracePoint + byte *oldCoords; _coords2 = _coordsBuf2; - byte *tempCoordsBuf = _coordsBuf; // first point on path - esi - byte *tempCoords = _coords; // edi + byte *tempCoordsBuf = _coordsBuf; // first point on path + byte *tempCoords = _coords; int x1, y1, x2, y2; if (tempCoordsBuf != tempCoords) { tempCoords -= 4; // last point on path - // loop - while (1) { + while (tempCoordsBuf != tempCoords) { x1 = READ_UINT16(tempCoords); y1 = READ_UINT16(tempCoords + 2); - if (tempCoordsBuf != tempCoords) { - x2 = READ_UINT16(tempCoordsBuf); - y2 = READ_UINT16(tempCoordsBuf + 2); - tempCoordsBuf += 4; - //TracePoint - oldCoords = _coords2; - if (_coords2 == _coordsBuf2) { - //no_compare + x2 = READ_UINT16(tempCoordsBuf); + y2 = READ_UINT16(tempCoordsBuf + 2); + tempCoordsBuf += 4; + //TracePoint + oldCoords = _coords2; + if (_coords2 == _coordsBuf2) { + WRITE_UINT16(_coords2, x1); + WRITE_UINT16(_coords2 + 2, y1); + _coords2 += 4; + } else { + int testX = READ_UINT16(_coords2 - 4); + int testY = READ_UINT16(_coords2 - 2); + if (testX != x1 || testY != y1) { WRITE_UINT16(_coords2, x1); WRITE_UINT16(_coords2 + 2, y1); _coords2 += 4; - } else { - int testX = READ_UINT16(_coords2 - 4); - int testY = READ_UINT16(_coords2 - 2); - if (testX != x1 || testY != y1) { - //no_compare - WRITE_UINT16(_coords2, x1); - WRITE_UINT16(_coords2 + 2, y1); - _coords2 += 4; - } - } - //no_store_first - _tracePointFlag = 0; - _tracePointFirstPointFlag = true; - Graphics::drawLine(x1, y1, x2, y2, 0, &this->plotTracePoint, this); - if (!_tracePointFlag) { - tempCoords = tempCoordsBuf - 4; - tempCoordsBuf = _coordsBuf; - } else { - _coords2 = oldCoords; } + } + _tracePointFlag = 0; + _tracePointFirstPointFlag = true; + Graphics::drawLine(x1, y1, x2, y2, 0, &this->plotTracePoint, this); + if (!_tracePointFlag) { + tempCoords = tempCoordsBuf - 4; + tempCoordsBuf = _coordsBuf; } else { - break; + _coords2 = oldCoords; } } } diff --git a/engines/prince/prince.h b/engines/prince/prince.h index 54c9e65e89..2f7009517f 100644 --- a/engines/prince/prince.h +++ b/engines/prince/prince.h @@ -438,10 +438,9 @@ public: static const int32 kPathBitmapLen = (kMaxPicHeight / kPathGridStep * kMaxPicWidth / kPathGridStep) / 8; static const int32 kTracePts = 8000; static const int32 kPBW = kMaxPicWidth / 16; // PathBitmapWidth + byte *_roomPathBitmap; // PL - Sala byte *_roomPathBitmapTemp; // PL - SSala - - Direction _direction; byte *_coordsBufEnd; byte *_coordsBuf; // optimal path byte *_coords; // last path point adress from coordsBuf |