From efe3a662bfec950f9be3477547627dd745a98d6d Mon Sep 17 00:00:00 2001 From: uruk Date: Fri, 26 Jul 2013 14:38:06 +0200 Subject: AVALANCHE: Add comments to Graphics. --- engines/avalanche/graphics.cpp | 7 ++++++- engines/avalanche/graphics.h | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 0fcfdac023..1b5d686b0a 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -117,6 +117,7 @@ void Graphics::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 } ::Graphics::Surface Graphics::loadPictureGraphic(Common::File &file) { + // This function mimics Pascal's getimage(). // The height and the width are stored in 2-2 bytes. We have to add 1 to each because Pascal stores the value of them -1. uint16 pictureWidth = file.readUint16LE() + 1; uint16 pictureHeight = file.readUint16LE() + 1; @@ -125,7 +126,7 @@ void Graphics::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 picture.create(pictureWidth, pictureHeight, ::Graphics::PixelFormat::createFormatCLUT8()); - // Produce the picture. + // Produce the picture. We read it in row-by-row, and every row has 4 planes. for (byte y = 0; y < pictureHeight; y++) for (int8 plane = 3; plane >= 0; plane--) // The planes are in the opposite way. for (uint16 x = 0; x < pictureWidth; x += 8) { @@ -140,6 +141,10 @@ void Graphics::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 } ::Graphics::Surface Graphics::loadPictureRow(Common::File &file, uint16 width, uint16 height) { + // This function is our own creation, very much like the one above. The main differences are that + // we don't read the width and the height from the file, the planes are in a different order + // and we read the picture plane-by-plane. + ::Graphics::Surface picture; picture.create(width, height, ::Graphics::PixelFormat::createFormatCLUT8()); diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index dfd06a4ad0..0cee2feb8f 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -82,7 +82,7 @@ public: ::Graphics::Surface loadPictureGraphic(Common::File &file); // Reads Graphic-planar EGA data. ::Graphics::Surface loadPictureRow(Common::File &file, uint16 width, uint16 height); // Reads Row-planar EGA data. - + // Further information about these two: http://www.shikadi.net/moddingwiki/Raw_EGA_data void drawPicture(const ::Graphics::Surface &picture, uint16 destX, uint16 destY); // Can't call .free() here. See Lucerna::showscore() for example. -- cgit v1.2.3