Support for vertical scrolling. Patch 3005933 by fuzzie.

svn-id: r49620
This commit is contained in:
Nicola Mettifogo 2010-06-13 06:55:58 +00:00
parent 3cacd7bc43
commit d16eb491b1
2 changed files with 9 additions and 3 deletions

View file

@ -222,10 +222,12 @@ void Gfx::drawGfxObject(GfxObj *obj, Graphics::Surface &surf) {
obj->getRect(obj->frame, rect);
int x = obj->x;
int y = obj->y;
if (_overlayMode) {
x += _scrollPosX;
y += _scrollPosY;
}
rect.translate(x, obj->y);
rect.translate(x, y);
data = obj->getData(obj->frame);
if (obj->getSize(obj->frame) == obj->getRawSize(obj->frame)) {

View file

@ -317,8 +317,10 @@ void Gfx::drawList(Graphics::Surface &surface, GfxObjArray &list) {
void Gfx::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) {
if (_doubleBuffering) {
if (_overlayMode)
if (_overlayMode) {
x += _scrollPosX;
y += _scrollPosY;
}
byte *dst = (byte*)_backBuffer.getBasePtr(x, y);
for (int i = 0; i < h; i++) {
@ -358,7 +360,7 @@ void Gfx::unlockScreen() {
void Gfx::updateScreenIntern() {
if (_doubleBuffering) {
byte *data = (byte*)_backBuffer.getBasePtr(_scrollPosX, 0);
byte *data = (byte*)_backBuffer.getBasePtr(_scrollPosX, _scrollPosY);
_vm->_system->copyRectToScreen(data, _backBuffer.pitch, 0, 0, _vm->_screenWidth, _vm->_screenHeight);
}
@ -863,6 +865,8 @@ void Gfx::setBackground(uint type, BackgroundInfo *info) {
_minScrollX = 0;
_maxScrollX = MAX<int>(0, _backgroundInfo->width - _vm->_screenWidth);
_minScrollY = 0;
_maxScrollY = MAX<int>(0, _backgroundInfo->height - _vm->_screenHeight);
}