aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorStrangerke2013-10-02 23:39:18 +0200
committerStrangerke2013-10-02 23:39:18 +0200
commitefe6236e7ba901571123e11d4a2c9d36ba0a9069 (patch)
tree72781e4cce11282befe7d899705526727fbeb52a /engines
parent9093b2c258c9f39a594265fa856af1a62a2a283a (diff)
downloadscummvm-rg350-efe6236e7ba901571123e11d4a2c9d36ba0a9069.tar.gz
scummvm-rg350-efe6236e7ba901571123e11d4a2c9d36ba0a9069.tar.bz2
scummvm-rg350-efe6236e7ba901571123e11d4a2c9d36ba0a9069.zip
AVALANCHE: Make _surface private
Diffstat (limited to 'engines')
-rw-r--r--engines/avalanche/avalot.cpp2
-rw-r--r--engines/avalanche/background.cpp13
-rw-r--r--engines/avalanche/graphics.cpp22
-rw-r--r--engines/avalanche/graphics.h24
4 files changed, 35 insertions, 26 deletions
diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp
index 4f30b824d5..8cc11917f7 100644
--- a/engines/avalanche/avalot.cpp
+++ b/engines/avalanche/avalot.cpp
@@ -198,7 +198,7 @@ void Clock::drawHand(const Common::Point &endPoint, Color color) {
if (endPoint.x == 177)
return;
- _vm->_graphics->_surface.drawLine(kCenterX, kCenterY, endPoint.x, endPoint.y, color);
+ _vm->_graphics->drawScreenLine(kCenterX, kCenterY, endPoint.x, endPoint.y, color);
}
void Clock::plotHands() {
diff --git a/engines/avalanche/background.cpp b/engines/avalanche/background.cpp
index e72e4a4cca..99bb446d3f 100644
--- a/engines/avalanche/background.cpp
+++ b/engines/avalanche/background.cpp
@@ -294,16 +294,9 @@ void Background::load(byte number) {
_sprites[i]._yl = sprite._yl;
_sprites[i]._type = sprite._type;
- if (natural) {
- _sprites[i]._type = kNaturalImage; // We simply read from the screen and later, in drawSprite() we draw it right back.
- _sprites[i]._size = _sprites[i]._xl * 8 * _sprites[i]._yl + 1;
- _sprites[i]._picture.create(_sprites[i]._xl * 8, _sprites[i]._yl + 1, Graphics::PixelFormat::createFormatCLUT8());
-
- for (uint16 y = 0; y < _sprites[i]._yl + 1; y++) {
- for (uint16 x = 0; x < _sprites[i]._xl * 8; x++)
- *(byte *)_sprites[i]._picture.getBasePtr(x, y) = *(byte *)_vm->_graphics->_surface.getBasePtr(_sprites[i]._x * 8 + x, _sprites[i]._y + y);
- }
- } else {
+ if (natural)
+ _vm->_graphics->getNaturalPicture(_sprites[i]);
+ else {
_sprites[i]._size = sprite._size;
_sprites[i]._picture = _vm->_graphics->loadPictureRow(f, _sprites[i]._xl * 8, _sprites[i]._yl + 1);
}
diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp
index ff998a0534..a733dfa5f1 100644
--- a/engines/avalanche/graphics.cpp
+++ b/engines/avalanche/graphics.cpp
@@ -86,7 +86,11 @@ void GraphicManager::init() {
_scrolls.create(kScreenWidth, kScreenHeight, Graphics::PixelFormat::createFormatCLUT8());
}
-void GraphicManager::loadDigits(Common::File &file) { // Load the scoring digits & rwlites
+/**
+ * Load the scoring digits & rwlites
+ * @remarks Originally called 'load_digits'
+ */
+void GraphicManager::loadDigits(Common::File &file) {
const byte digitsize = 134;
const byte rwlitesize = 126;
@@ -512,6 +516,10 @@ void GraphicManager::setAlsoLine(int x1, int y1, int x2, int y2, Color color) {
_magics.drawLine(x1, y1, x2, y2, color);
}
+void GraphicManager::drawScreenLine(int16 x, int16 y, int16 x2, int16 y2, Color color) {
+ _surface.drawLine(x, y, x2, y2, color);
+}
+
byte GraphicManager::getAlsoColor(int x1, int y1, int x2, int y2) {
byte returnColor = 0;
for (int16 i = x1; i <= x2; i++) {
@@ -553,7 +561,7 @@ void GraphicManager::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x,
}
}
-void GraphicManager::drawPicture(Graphics::Surface &target, const Graphics::Surface &picture, uint16 destX, uint16 destY) {
+void GraphicManager::drawPicture(Graphics::Surface &target, const Graphics::Surface picture, uint16 destX, uint16 destY) {
// Copy the picture to the given place on the screen.
for (uint16 y = 0; y < picture.h; y++) {
for (uint16 x = 0; x < picture.w; x++)
@@ -701,6 +709,16 @@ void GraphicManager::showScroll() {
_surface.copyFrom(_scrolls); // TODO: Rework it using getSubArea !!!!!!!
}
+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++)
+ *(byte *)sprite._picture.getBasePtr(x, y) = *(byte *)_vm->_graphics->_surface.getBasePtr(sprite._x * 8 + x, sprite._y + y);
+ }
+}
+
void GraphicManager::saveScreen() {
_backup.copyFrom(_surface);
}
diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h
index b3710742ca..8a9d26cb99 100644
--- a/engines/avalanche/graphics.h
+++ b/engines/avalanche/graphics.h
@@ -39,11 +39,7 @@ class AvalancheEngine;
struct SpriteType;
typedef byte FontType[256][16];
-
typedef byte ManiType[2049];
-// manitype = array[5..2053] of byte;
-// Be aware!!!
-
typedef byte SilType[51][11]; // 35, 4
class SpriteInfo {
@@ -55,21 +51,19 @@ public:
uint16 _size; // The size of one picture.
};
-struct MouseHotspotType { // mouse-void
+struct MouseHotspotType {
int16 _horizontal, _vertical;
};
class GraphicManager {
public:
static const MouseHotspotType kMouseHotSpots[9];
-
- Graphics::Surface _surface;
Color _talkBackgroundColor, _talkFontColor;
GraphicManager(AvalancheEngine *vm);
~GraphicManager();
void init();
- void loadDigits(Common::File &file); // Load the scoring digits & rwlites
+ void loadDigits(Common::File &file);
void loadMouse(byte which);
void fleshColors();
@@ -104,7 +98,7 @@ public:
Graphics::Surface loadPictureRow(Common::File &file, uint16 width, uint16 height); // Reads Row-planar EGA data.
void drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y);
- void drawPicture(Graphics::Surface &target, const Graphics::Surface &picture, uint16 destX, uint16 destY); // Can't call .free() here. See showScore() for example.
+ void drawPicture(Graphics::Surface &target, const Graphics::Surface picture, uint16 destX, uint16 destY); // Can't call .free() here. See showScore() for example.
void drawThinkPic(Common::String filename, int id);
void drawToolbar();
@@ -112,6 +106,7 @@ public:
void drawReadyLight(Color color);
void drawSign(Common::String name, int16 xl, int16 yl, int16 y); // This is for drawing a big "about" or "gameover" picture loaded from a file into an empty scroll.
void drawIcon(int16 x, int16 y, byte which); // Draws an icon to the current scroll.
+ void drawScreenLine(int16 x, int16 y, int16 x2, int16 y2, Color color);
void prepareBubble(int xc, int xw, int my, Common::Point points[3]);
@@ -122,25 +117,28 @@ public:
void setDialogColor(Color bg, Color text);
void zoomOut(int16 x, int16 y); // Only used when entering the map.
-
void showScroll();
+ void getNaturalPicture(SpriteType &sprite);
+
void saveScreen();
void removeBackup();
void restoreScreen();
+
private:
static const uint16 kBackgroundWidth = kScreenWidth;
+ static const byte kEgaPaletteIndex[16];
static const byte kBackgroundHeight = 8 * 12080 / kScreenWidth; // With 640 width it's 151.
// The 8 = number of bits in a byte, and 12080 comes from Lucerna::load().
- static const byte kEgaPaletteIndex[16];
Graphics::Surface _background;
- Graphics::Surface _magics; // Lucerna::draw_also_lines() draws the "magical" lines here. Further information: https://github.com/urukgit/avalot/wiki/Also
+ Graphics::Surface _backup;
Graphics::Surface _digits[10]; // digitsize and rwlitesize are defined in loadDigits() !!!
Graphics::Surface _directions[9]; // Maybe it will be needed to move them to the class itself instead.
+ Graphics::Surface _magics; // Lucerna::draw_also_lines() draws the "magical" lines here. Further information: https://github.com/urukgit/avalot/wiki/Also
Graphics::Surface _screen; // Only used in refreshScreen() to make it more optimized. (No recreation of it at every call of the function.)
Graphics::Surface _scrolls;
- Graphics::Surface _backup;
+ Graphics::Surface _surface;
byte _egaPalette[64][3];
AvalancheEngine *_vm;