Skip to content

Commit

Permalink
ACCESS: Improve usage of ImageEntry _flags IMGFLAG enum
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Dec 13, 2014
1 parent 953321c commit fde1ea9
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
10 changes: 6 additions & 4 deletions engines/access/access.cpp
Expand Up @@ -360,20 +360,20 @@ void AccessEngine::plotList1() {
Common::Rect destBounds = bounds;

if (_buffer2.clip(bounds)) {
ie._flags |= 1;
ie._flags |= IMGFLAG_CROPPED;
} else {
ie._flags &= ~1;
ie._flags &= ~IMGFLAG_CROPPED;
if (_buffer2._leftSkip != 0 || _buffer2._rightSkip != 0
|| _buffer2._topSkip != 0 || _buffer2._bottomSkip != 0)
ie._flags |= 1;
ie._flags |= IMGFLAG_CROPPED;

_newRects.push_back(bounds);

if (!_imgUnscaled) {
_buffer2._rightSkip /= _scale;
bounds.setWidth(bounds.width() / _scale);

if (ie._flags & 2) {
if (ie._flags & IMGFLAG_BACKWARDS) {
_buffer2.sPlotB(frame, destBounds);
} else {
_buffer2.sPlotF(frame, destBounds);
Expand All @@ -386,6 +386,8 @@ void AccessEngine::plotList1() {
}
}
}

ie._flags |= IMGFLAG_DRAWN;
}
}

Expand Down
4 changes: 2 additions & 2 deletions engines/access/amazon/amazon_game.cpp
Expand Up @@ -1147,10 +1147,10 @@ void Guard::guardSee() {

void Guard::setGuardFrame() {
ImageEntry ie;
ie._flags = 8;
ie._flags = IMGFLAG_UNSCALED;

if (_vm->_guardLocation == 4)
ie._flags |= 2;
ie._flags |= IMGFLAG_BACKWARDS;
ie._spritesPtr = _vm->_objectsTable[37];
ie._frameNumber = _guardCel;
ie._position = _position;
Expand Down
14 changes: 7 additions & 7 deletions engines/access/amazon/amazon_scripts.cpp
Expand Up @@ -301,7 +301,7 @@ void AmazonScripts::jungleMove() {

for (int i = 0; i < count; ++i) {
ImageEntry ie;
ie._flags = 8;
ie._flags = IMGFLAG_UNSCALED;
ie._spritesPtr = _vm->_objectsTable[24];
ie._frameNumber = _jCnt[i] + frameOffset;
ie._position = Common::Point(_jungleX[i], jungleY[i]);
Expand Down Expand Up @@ -437,7 +437,7 @@ void AmazonScripts::pan() {

for (int i = 0; i < _pNumObj; i++) {
ImageEntry ie;
ie._flags= 8;
ie._flags = IMGFLAG_UNSCALED;
ie._position = Common::Point(_pObjX[i], _pObjY[i]);
ie._offsetY = 255;
ie._spritesPtr = _pObject[i];
Expand Down Expand Up @@ -1046,7 +1046,7 @@ void AmazonScripts::plotTorchSpear(int indx, const int *&buf) {
int idx = indx;

ImageEntry ie;
ie._flags = 8;
ie._flags = IMGFLAG_UNSCALED;
ie._spritesPtr = _vm->_objectsTable[62];
ie._frameNumber = buf[(idx / 2)];
ie._position = Common::Point(_game->_pitPos.x + buf[(idx / 2) + 1], _game->_pitPos.y + buf[(idx / 2) + 2]);
Expand All @@ -1057,7 +1057,7 @@ void AmazonScripts::plotTorchSpear(int indx, const int *&buf) {
void AmazonScripts::plotPit(int indx, const int *&buf) {
int idx = indx;
ImageEntry ie;
ie._flags = 8;
ie._flags = IMGFLAG_UNSCALED;
ie._spritesPtr = _vm->_objectsTable[62];
ie._frameNumber = buf[(idx / 2)];
ie._position = Common::Point(_game->_pitPos.x, _game->_pitPos.y);
Expand Down Expand Up @@ -1233,7 +1233,7 @@ void AmazonScripts::ANT() {
}

ImageEntry ie;
ie._flags = 8;
ie._flags = IMGFLAG_UNSCALED;
ie._spritesPtr = _vm->_objectsTable[61];
ie._frameNumber = buf[(idx / 2)];
ie._position = Common::Point(_game->_antPos.x, _game->_antPos.y);
Expand Down Expand Up @@ -1730,7 +1730,7 @@ void AmazonScripts::plotRiver() {
}

ImageEntry ie;
ie._flags = 8;
ie._flags = IMGFLAG_UNSCALED;
ie._spritesPtr = _vm->_objectsTable[45];
ie._frameNumber = _game->_canoeFrame;
ie._position.x = (_vm->_screen->_scrollCol * 16) + _vm->_screen->_scrollX + 160;
Expand All @@ -1741,7 +1741,7 @@ void AmazonScripts::plotRiver() {
RiverStruct *cur = _game->_topList;
while (cur <= _game->_botList) {
if (cur[0]._id != -1) {
ie._flags = 8;
ie._flags = IMGFLAG_UNSCALED;
ie._spritesPtr = _vm->_objectsTable[45];
ie._frameNumber = 0;
ie._position.x = cur[0]._field5;
Expand Down
3 changes: 2 additions & 1 deletion engines/access/asurface.h
Expand Up @@ -131,7 +131,8 @@ class SpriteResource {
SpriteFrame *getFrame(int idx) { return _frames[idx]; }
};

enum ImageFlag { IMGFLAG_BACKWARDS = 2, IMGFLAG_UNSCALED = 8 };
enum ImageFlag { IMGFLAG_CROPPED = 1, IMGFLAG_BACKWARDS = 2, IMGFLAG_DRAWN = 4,
IMGFLAG_UNSCALED = 8 };

class ImageEntry {
public:
Expand Down

0 comments on commit fde1ea9

Please sign in to comment.