Skip to content

Commit

Permalink
ACCESS: Fix loop in buildScreen
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Aug 10, 2014
1 parent 6f2bc7f commit e833ae6
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 20 deletions.
18 changes: 17 additions & 1 deletion engines/access/asurface.cpp
Expand Up @@ -168,7 +168,10 @@ void ASurface::plotImage(SpriteResource *sprite, int frameNum, const Common::Poi
}

void ASurface::plotFrame(SpriteFrame *frame, const Common::Point &pt) {
return;
frame->copyTo(this, pt);
// g_system->copyRectToScreen((byte *)getPixels(), 320, 0, 0, 320, 200);
// g_system->updateScreen();


/*
byte *destP = (byte *)getBasePtr(pt.x, _scrollY + pt.y);
Expand Down Expand Up @@ -204,4 +207,17 @@ void ASurface::plotFrame(SpriteFrame *frame, const Common::Point &pt) {
*/
}

void ASurface::copyTo(ASurface *dest, const Common::Point &destPos) {
for (int yp = 0; yp < h; ++yp) {
byte *srcP = (byte *)getBasePtr(0, yp);
byte *destP = (byte *)dest->getBasePtr(destPos.x, destPos.y + yp);

for (int xp = 0; xp < this->w; ++xp, ++srcP, ++destP) {
if (*srcP != 0)
*destP = *srcP;
}
}
}


} // End of namespace Access
42 changes: 24 additions & 18 deletions engines/access/asurface.h
Expand Up @@ -32,24 +32,8 @@

namespace Access {

class SpriteFrame : public Graphics::Surface {
public:
SpriteFrame(AccessEngine *vm, Common::MemoryReadStream &stream, int frameSize);
~SpriteFrame();
};

class SpriteResource {
public:
Common::Array<SpriteFrame *> _frames;
public:
SpriteResource(AccessEngine *vm, const byte *data, uint32 size,
DisposeAfterUse::Flag disposeMemory = DisposeAfterUse::NO);
~SpriteResource();

int getCount() { return _frames.size(); }

SpriteFrame *getFrame(int idx) { return _frames[idx]; }
};
class SpriteResource;
class SpriteFrame;

class ASurface : public Graphics::Surface {
public:
Expand All @@ -71,8 +55,30 @@ class ASurface : public Graphics::Surface {
bool clip(Common::Rect &r);

void plotImage(SpriteResource *sprite, int frameNum, const Common::Point &pt);

void copyTo(ASurface *dest, const Common::Point &destPos);
};

class SpriteFrame : public ASurface {
public:
SpriteFrame(AccessEngine *vm, Common::MemoryReadStream &stream, int frameSize);
~SpriteFrame();
};

class SpriteResource {
public:
Common::Array<SpriteFrame *> _frames;
public:
SpriteResource(AccessEngine *vm, const byte *data, uint32 size,
DisposeAfterUse::Flag disposeMemory = DisposeAfterUse::NO);
~SpriteResource();

int getCount() { return _frames.size(); }

SpriteFrame *getFrame(int idx) { return _frames[idx]; }
};


} // End of namespace Access

#endif /* ACCESS_ASURFACE_H */
2 changes: 1 addition & 1 deletion engines/access/room.cpp
Expand Up @@ -296,7 +296,7 @@ void Room::buildScreen() {
int cnt = _vWindowWidth + 1;
int offset = 0;

for (int idx = 0; idx < cnt, offset += TILE_WIDTH; ++idx) {
for (int idx = 0; idx < cnt; offset += TILE_WIDTH, ++idx) {
buildColumn(_vm->_screen->_scrollCol, offset);
++_vm->_screen->_scrollCol;
}
Expand Down

0 comments on commit e833ae6

Please sign in to comment.