mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-13 07:14:59 +00:00
AVALANCHE: Make _surface private
This commit is contained in:
parent
9093b2c258
commit
efe6236e7b
@ -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() {
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user