ACCESS: Implemented plotList

This commit is contained in:
Paul Gilbert 2014-08-11 23:12:53 -04:00
parent 7d4180c3e2
commit eee84b8760
10 changed files with 87 additions and 11 deletions

View File

@ -73,6 +73,7 @@ AccessEngine::AccessEngine(OSystem *syst, const AccessGameDescription *gameDesc)
_scaleT1 = 0;
_scaleMaxY = 0;
_scaleI = 0;
_scaleFlag = false;
_conversation = 0;
_currentMan = 0;
@ -247,4 +248,54 @@ void AccessEngine::doEstablish(int v) {
warning("TODO: doEstablish");
}
void AccessEngine::plotList() {
_player->calcPlayer();
plotList1();
}
void AccessEngine::plotList1() {
for (uint idx = 0; idx < _images.size(); ++idx) {
ImageEntry &ie = _images[idx];
_scaleFlag = (ie._flags & 8) != 0;
Common::Point pt = ie._position - _screen->_bufferStart;
SpriteResource *sprites = ie._spritesPtr;
SpriteFrame *frame = sprites->getFrame(ie._frameNumber);
Common::Rect bounds(pt.x, pt.y, pt.x + frame->w, pt.y + frame->h);
if (!_scaleFlag) {
bounds.setWidth(_screen->_scaleTable1[frame->w]);
bounds.setHeight(_screen->_scaleTable1[frame->h]);
}
if (_buffer2.clip(bounds)) {
ie._flags |= 1;
} else {
ie._flags &= ~1;
if (_buffer2._leftSkip != 0 || _buffer2._rightSkip != 0
|| _buffer2._topSkip != 0 || _buffer2._bottomSkip != 0)
ie._flags |= 1;
_newRect.push_back(bounds);
if (!_scaleFlag) {
_buffer2._rightSkip /= _scale;
bounds.setWidth(bounds.width() / _scale);
if (ie._flags & 2) {
_buffer2.sPlotB(frame, Common::Point(bounds.left, bounds.top));
} else {
_buffer2.sPlotF(frame, Common::Point(bounds.left, bounds.top));
}
} else {
if (ie._flags & 2) {
_buffer2.plotB(frame, Common::Point(bounds.left, bounds.top));
} else {
_buffer2.plotFrame(frame, Common::Point(bounds.left, bounds.top));
}
}
}
}
}
} // End of namespace Access

View File

@ -72,7 +72,7 @@ struct AccessGameDescription;
class ImageEntry {
public:
int _field0;
int _frameNumber;
SpriteResource *_spritesPtr;
int _priority;
Common::Point _position;
@ -166,6 +166,7 @@ public:
int _scaleT1;
int _scaleMaxY;
int _scaleI;
bool _scaleFlag;
int _playFieldHeight;
// Fields that are included in savegames
@ -236,6 +237,9 @@ public:
void establish(int v);
void establishCenter(int v);
void plotList();
void plotList1();
};
} // End of namespace Access

View File

@ -230,7 +230,7 @@ void Animation::setFrame1(AnimationFrame *frame) {
// Set the other fields
ie._spritesPtr = _vm->_objectsTable[part->_spritesIndex];
ie._field0 = part->_frameIndex;
ie._frameNumber = part->_frameIndex;
ie._position = part->_position + _vm->_animation->_base;
ie._priority = part->_priority - ie._position.y;

View File

@ -219,5 +219,16 @@ void ASurface::copyTo(ASurface *dest, const Common::Point &destPos) {
}
}
void ASurface::sPlotB(SpriteFrame *frame, const Common::Point &pt) {
error("TODO");
}
void ASurface::sPlotF(SpriteFrame *frame, const Common::Point &pt) {
error("TODO");
}
void ASurface::plotB(SpriteFrame *frame, const Common::Point &pt) {
error("TODO");
}
} // End of namespace Access

View File

@ -45,7 +45,7 @@ public:
static int _scrollX, _scrollY;
static void init();
protected:
public:
virtual void ASurface::plotFrame(SpriteFrame *frame, const Common::Point &pt);
public:
void clearBuffer();
@ -56,6 +56,12 @@ public:
void plotImage(SpriteResource *sprite, int frameNum, const Common::Point &pt);
void sPlotB(SpriteFrame *frame, const Common::Point &pt);
void sPlotF(SpriteFrame *frame, const Common::Point &pt);
void plotB(SpriteFrame *frame, const Common::Point &pt);
void copyTo(ASurface *dest, const Common::Point &destPos);
};

View File

@ -151,4 +151,12 @@ void Player::walk() {
warning("TODO: Player::walk");
}
void Player::calcPlayer() {
Screen &scr = *_vm->_screen;
scr._bufferStart.x = (scr._scrollCol << 4) + scr._scrollX;
scr._bufferStart.y = (scr._scrollRow << 4) + scr._scrollY;
_playerX = _rawPlayer.x - scr._bufferStart.x;
_playerY = _rawPlayer.y - scr._bufferStart.y;
}
} // End of namespace Access

View File

@ -82,6 +82,8 @@ public:
void calcManScale();
void walk();
void calcPlayer();
};
} // End of namespace Access

View File

@ -117,7 +117,7 @@ void Room::doRoom() {
clearRoom();
break;
} else {
_vm->_screen->plotList();
_vm->plotList();
_vm->_screen->copyRects();
_vm->_screen->copyBF2Vid();
@ -132,7 +132,7 @@ void Room::doRoom() {
clearRoom();
break;
} else {
_vm->_screen->plotList();
_vm->plotList();
_vm->_screen->copyBlocks();
}
}

View File

@ -162,10 +162,6 @@ void Screen::copyBF2Vid() {
warning("TODO");
}
void Screen::plotList() {
warning("TODO: plotList");
}
void Screen::copyBlocks() {
warning("TODO: copyBlocks");
}

View File

@ -123,8 +123,6 @@ public:
void copyBF2Vid();
void plotList();
void copyBlocks();
void copyRects();