Skip to content

Commit

Permalink
AVALANCHE: Some renaming in Background.
Browse files Browse the repository at this point in the history
  • Loading branch information
uruk committed Feb 4, 2014
1 parent a0e2810 commit 81992bf
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
16 changes: 8 additions & 8 deletions engines/avalanche/background.cpp
Expand Up @@ -279,24 +279,24 @@ void Background::load(byte number) {
sprite._type = (PictureType)(f.readByte());
sprite._x = f.readSint16LE();
sprite._y = f.readSint16LE();
sprite._xl = f.readSint16LE();
sprite._yl = f.readSint16LE();
sprite._width = f.readSint16LE();
sprite._height = f.readSint16LE();
sprite._size = f.readSint32LE();
bool natural = f.readByte();
bool memorize = f.readByte();

if (memorize) {
_sprites[i]._x = sprite._x;
_sprites[i]._xl = sprite._xl;
_sprites[i]._width = sprite._width;
_sprites[i]._y = sprite._y;
_sprites[i]._yl = sprite._yl;
_sprites[i]._height = sprite._height;
_sprites[i]._type = sprite._type;

if (natural)
_vm->_graphics->getNaturalPicture(_sprites[i]);
else {
_sprites[i]._size = sprite._size;
_sprites[i]._picture = _vm->_graphics->loadPictureRaw(f, _sprites[i]._xl * 8, _sprites[i]._yl + 1);
_sprites[i]._picture = _vm->_graphics->loadPictureRaw(f, _sprites[i]._width * 8, _sprites[i]._height + 1);
}
} else
_sprites[i]._x = kOnDisk;
Expand Down Expand Up @@ -335,11 +335,11 @@ void Background::draw(int16 destX, int16 destY, byte sprId) {
sprite._type = (PictureType)(f.readByte());
sprite._x = f.readSint16LE();
sprite._y = f.readSint16LE();
sprite._xl = f.readSint16LE();
sprite._yl = f.readSint16LE();
sprite._width = f.readSint16LE();
sprite._height = f.readSint16LE();
sprite._size = f.readSint32LE();
f.skip(2); // Natural and Memorize are used in Load()
sprite._picture = _vm->_graphics->loadPictureRaw(f, sprite._xl * 8, sprite._yl + 1);
sprite._picture = _vm->_graphics->loadPictureRaw(f, sprite._width * 8, sprite._height + 1);

if (destX < 0) {
destX = sprite._x * 8;
Expand Down
2 changes: 1 addition & 1 deletion engines/avalanche/background.h
Expand Up @@ -40,7 +40,7 @@ enum PictureType {kEga, kBgi, kNaturalImage};
struct SpriteType {
PictureType _type;
int16 _x, _y;
int16 _xl, _yl;
int16 _width, _height;
int32 _size;
Graphics::Surface _picture;
};
Expand Down
8 changes: 4 additions & 4 deletions engines/avalanche/graphics.cpp
Expand Up @@ -850,10 +850,10 @@ void GraphicManager::showScroll() {

void GraphicManager::getNaturalPicture(SpriteType &sprite) {
sprite._type = kNaturalImage; // We simply read from the screen and later, in drawSprite() we draw it right back.
sprite._size = sprite._xl * 8 * sprite._yl + 1;
sprite._picture.create(sprite._xl * 8, sprite._yl + 1, Graphics::PixelFormat::createFormatCLUT8());
for (uint16 y = 0; y < sprite._yl + 1; y++) {
for (uint16 x = 0; x < sprite._xl * 8; x++)
sprite._size = sprite._width * 8 * sprite._height + 1;
sprite._picture.create(sprite._width * 8, sprite._height + 1, Graphics::PixelFormat::createFormatCLUT8());
for (uint16 y = 0; y < sprite._height + 1; y++) {
for (uint16 x = 0; x < sprite._width * 8; x++)
*(byte *)sprite._picture.getBasePtr(x, y) = *(byte *)_vm->_graphics->_surface.getBasePtr(sprite._x * 8 + x, sprite._y + y);
}
}
Expand Down

0 comments on commit 81992bf

Please sign in to comment.