diff options
author | Andrew Kurushin | 2004-12-29 14:33:14 +0000 |
---|---|---|
committer | Andrew Kurushin | 2004-12-29 14:33:14 +0000 |
commit | 6b4264d3a8cb5ebd32b7510bffe781bb2f1ba8aa (patch) | |
tree | b29a5db4be8e0bb2b1c1af78230fc9bda00ab638 /saga | |
parent | 4d46b7882a42469932a89149e1fc2c6a0a3fa280 (diff) | |
download | scummvm-rg350-6b4264d3a8cb5ebd32b7510bffe781bb2f1ba8aa.tar.gz scummvm-rg350-6b4264d3a8cb5ebd32b7510bffe781bb2f1ba8aa.tar.bz2 scummvm-rg350-6b4264d3a8cb5ebd32b7510bffe781bb2f1ba8aa.zip |
- fixed fingolfin notification
svn-id: r16369
Diffstat (limited to 'saga')
-rw-r--r-- | saga/actor.cpp | 19 | ||||
-rw-r--r-- | saga/actor.h | 10 |
2 files changed, 13 insertions, 16 deletions
diff --git a/saga/actor.cpp b/saga/actor.cpp index e2269c6372..f37ddbe799 100644 --- a/saga/actor.cpp +++ b/saga/actor.cpp @@ -94,7 +94,7 @@ Actor::Actor(SagaEngine *vm) : _vm(vm) { _xCellCount = _vm->getDisplayWidth() / 2; _pathCellCount = _yCellCount * _xCellCount; - _pathCell = (byte*)malloc(_pathCellCount); + _pathCell = (int*)malloc(_pathCellCount * sizeof *_pathCell); _pathRect.left = 0; _pathRect.right = _vm->getDisplayWidth(); @@ -1120,7 +1120,7 @@ void Actor::findActorPath(ActorData * actor, const Point &pointFrom, const Point Point bestPoint; Point maskPoint; int maskType1, maskType2; - byte cellValue; + int cellValue; int i; Rect intersect; @@ -1140,7 +1140,7 @@ void Actor::findActorPath(ActorData * actor, const Point &pointFrom, const Point maskType1 = _vm->_scene->getBGMaskType(maskPoint); maskPoint.x += 1; maskType2 = _vm->_scene->getBGMaskType(maskPoint); - cellValue = (maskType1 | maskType2) ? 'W' : -1; + cellValue = (maskType1 | maskType2) ? kPathCellBarrier : kPathCellEmpty; setPathCell(iteratorPoint, cellValue); } } @@ -1158,7 +1158,7 @@ void Actor::findActorPath(ActorData * actor, const Point &pointFrom, const Point for (iteratorPoint.y = intersect.top; iteratorPoint.y < intersect.bottom; iteratorPoint.y++) { for (iteratorPoint.x = 0; iteratorPoint.x < _xCellCount; iteratorPoint.x++) { - setPathCell(iteratorPoint, 'W'); + setPathCell(iteratorPoint, kPathCellBarrier); } } } @@ -1234,7 +1234,7 @@ bool Actor::scanPathLine(const Point &point1, const Point &point2) { iteratorPoint.x = point.x >> 1; iteratorPoint.y = point.y - _vm->getPathYOffset(); - if (getPathCell(iteratorPoint) == 'W') + if (getPathCell(iteratorPoint) == kPathCellBarrier) return false; } return true; @@ -1284,14 +1284,7 @@ int Actor::fillPathArray(const Point &pointFrom, const Point &pointTo, Point &be Point nextPoint; nextPoint.x = samplePathDirection->x + pathDirection->x; nextPoint.y = samplePathDirection->y + pathDirection->y; - // FIXME: The following two "if" statements are equivalent, but the first one at least - // generates no warning ;-) - // getPathCell returns a byte, which is unsigned, so "getPathCell(nextPoint)" < 0 is always false. - // I assume that the proper fix would be to change the return value of getPathCell to be signed - // or something like that, but I'll leave that to the authors... - // Alas, once more, compiling with all warnings and -Werror proves useful :-) - if (false) { - //if ((nextPoint.x >= 0) && (nextPoint.y >= 0) && (nextPoint.x < _xCellCount) && (nextPoint.y < _yCellCount) && (getPathCell(nextPoint) < 0)) { + if ((nextPoint.x >= 0) && (nextPoint.y >= 0) && (nextPoint.x < _xCellCount) && (nextPoint.y < _yCellCount) && (getPathCell(nextPoint) == kPathCellEmpty)) { setPathCell(nextPoint, samplePathDirection->direction); newPathDirectionIterator = pathDirectionList.pushBack(); diff --git a/saga/actor.h b/saga/actor.h index b842b5b380..60e5de9f3f 100644 --- a/saga/actor.h +++ b/saga/actor.h @@ -111,6 +111,10 @@ enum ActorFlagsEx { kActorRandom = (1 << 10) }; +enum PathCellType { + kPathCellEmpty = -1, + kPathCellBarrier = 0x57 +}; struct PathDirectionData { int direction; @@ -279,10 +283,10 @@ private: void findActorPath(ActorData * actor, const Point &pointFrom, const Point &pointTo); void handleSpeech(int msec); void handleActions(int msec, bool setup); - void setPathCell(const Point &testPoint, byte value) { + void setPathCell(const Point &testPoint, int value) { _pathCell[testPoint.x + testPoint.y * _xCellCount] = value; } - byte getPathCell(const Point &testPoint) { + int getPathCell(const Point &testPoint) { return _pathCell[testPoint.x + testPoint.y * _xCellCount]; } bool scanPathLine(const Point &point1, const Point &point2); @@ -296,7 +300,7 @@ private: SpeechData _activeSpeech; Rect _barrierList[ACTOR_BARRIERS_MAX]; int _barrierCount; - byte *_pathCell; + int *_pathCell; int _pathCellCount; int _xCellCount; int _yCellCount; |