diff options
-rw-r--r-- | engines/prince/font.cpp | 25 | ||||
-rw-r--r-- | engines/prince/graphics.cpp | 16 | ||||
-rw-r--r-- | engines/prince/mhwanh.cpp | 19 | ||||
-rw-r--r-- | engines/prince/prince.cpp | 12 |
4 files changed, 25 insertions, 47 deletions
diff --git a/engines/prince/font.cpp b/engines/prince/font.cpp index d3ae4d6b83..8d812c4d15 100644 --- a/engines/prince/font.cpp +++ b/engines/prince/font.cpp @@ -31,36 +31,30 @@ namespace Prince { -Font::Font() -{ +Font::Font() { } -Font::~Font() -{ +Font::~Font() { delete _fontData; } -bool Font::load(Common::SeekableReadStream &stream) -{ +bool Font::load(Common::SeekableReadStream &stream) { stream.seek(0); _fontData = new byte[stream.size()]; stream.read(_fontData, stream.size()); return true; } -int Font::getFontHeight() const -{ +int Font::getFontHeight() const { debug("Font::getFontHeight %d", _fontData[5]); return _fontData[5]; } -int Font::getMaxCharWidth() const -{ +int Font::getMaxCharWidth() const { return 0; } -Font::ChrData Font::getChrData(byte chr) const -{ +Font::ChrData Font::getChrData(byte chr) const { chr -= 32; uint16 chrOffset = 4*chr+6; @@ -72,13 +66,11 @@ Font::ChrData Font::getChrData(byte chr) const return chrData; } -int Font::getCharWidth(byte chr) const -{ +int Font::getCharWidth(byte chr) const { return getChrData(chr)._width; } -void Font::drawChar(Graphics::Surface *dst, byte chr, int x, int y, uint32 color) const -{ +void Font::drawChar(Graphics::Surface *dst, byte chr, int x, int y, uint32 color) const { const ChrData chrData = getChrData(chr); const byte *src = chrData._pixels; byte *target = (byte *)dst->getBasePtr(x, y); @@ -88,7 +80,6 @@ void Font::drawChar(Graphics::Surface *dst, byte chr, int x, int y, uint32 color src += chrData._width; target += dst->pitch; } - } } diff --git a/engines/prince/graphics.cpp b/engines/prince/graphics.cpp index 2d26dc0443..356b35f832 100644 --- a/engines/prince/graphics.cpp +++ b/engines/prince/graphics.cpp @@ -6,28 +6,24 @@ namespace Prince { -GraphicsMan::GraphicsMan(PrinceEngine *vm) : _vm(vm), _changed(false) -{ +GraphicsMan::GraphicsMan(PrinceEngine *vm) + : _vm(vm), _changed(false) { initGraphics(640, 480, true); } -void GraphicsMan::update() -{ - if (_changed) - { +void GraphicsMan::update() { + if (_changed) { _vm->_system->copyRectToScreen((byte*)_roomBackground->getBasePtr(0,0), 640, 0, 0, 640, 480); _vm->_system->updateScreen(); } } -void GraphicsMan::setPalette(const byte *palette) -{ +void GraphicsMan::setPalette(const byte *palette) { _vm->_system->getPaletteManager()->setPalette(palette, 0, 256); } -void GraphicsMan::change() -{ +void GraphicsMan::change() { _changed = true; } diff --git a/engines/prince/mhwanh.cpp b/engines/prince/mhwanh.cpp index 5ad39313a0..0847220a70 100644 --- a/engines/prince/mhwanh.cpp +++ b/engines/prince/mhwanh.cpp @@ -28,19 +28,16 @@ namespace Prince { -MhwanhDecoder::MhwanhDecoder() : _surface(0), _palette(0), _paletteColorCount(0) -{ +MhwanhDecoder::MhwanhDecoder() + : _surface(0), _palette(0), _paletteColorCount(0) { } -MhwanhDecoder::~MhwanhDecoder() -{ +MhwanhDecoder::~MhwanhDecoder() { destroy(); } -void MhwanhDecoder::destroy() -{ - if (_surface) - { +void MhwanhDecoder::destroy() { + if (_surface) { _surface->free(); _surface = 0; } @@ -49,8 +46,7 @@ void MhwanhDecoder::destroy() _paletteColorCount = 0; } -bool MhwanhDecoder::loadStream(Common::SeekableReadStream &stream) -{ +bool MhwanhDecoder::loadStream(Common::SeekableReadStream &stream) { _paletteColorCount = 256; stream.seek(0); stream.skip(0x20); @@ -64,8 +60,7 @@ bool MhwanhDecoder::loadStream(Common::SeekableReadStream &stream) _surface = new Graphics::Surface(); _surface->create(640, 480, Graphics::PixelFormat::createFormatCLUT8()); - for (int h = 0; h < 480; ++h) - { + for (int h = 0; h < 480; ++h) { stream.read(_surface->getBasePtr(0, h - 1), 640); } diff --git a/engines/prince/prince.cpp b/engines/prince/prince.cpp index 29451c8e66..9cd7056a41 100644 --- a/engines/prince/prince.cpp +++ b/engines/prince/prince.cpp @@ -79,8 +79,7 @@ Common::Error PrinceEngine::run() { return Common::kPathNotFile;
Font font1 = Font();
- if (font1.load(*font1stream))
- {
+ if (font1.load(*font1stream)) {
font1.getCharWidth(103);
}
delete font1stream;
@@ -90,8 +89,7 @@ Common::Error PrinceEngine::run() { //_frontScreen = new Graphics::Surface();
//_frontScreen->create(640, 480, Graphics::PixelFormat::createFormatCLUT8());
- if (room)
- {
+ if (room) {
Graphics::BitmapDecoder roomBmp;
roomBmp.loadStream(*room);
//_roomBackground = roomBmp.getSurface();
@@ -100,11 +98,9 @@ Common::Error PrinceEngine::run() { //font1.drawString(_frontScreen, "Hello World", 10, 10, 640, 1);
MhwanhDecoder walizkaBmp;
- if (walizka)
- {
+ if (walizka) {
debug("Loading walizka");
- if (walizkaBmp.loadStream(*walizka))
- {
+ if (walizkaBmp.loadStream(*walizka)) {
_graph->_roomBackground = walizkaBmp.getSurface();
_graph->setPalette(walizkaBmp.getPalette());
}
|