1 /* ScummVM - Graphic Adventure Engine 2 * 3 * ScummVM is the legal property of its developers, whose names 4 * are too numerous to list here. Please refer to the COPYRIGHT 5 * file distributed with this source distribution. 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 */ 22 23 #ifndef NEVERHOOD_SCREEN_H 24 #define NEVERHOOD_SCREEN_H 25 26 #include "common/array.h" 27 #include "graphics/surface.h" 28 #include "neverhood/neverhood.h" 29 #include "neverhood/microtiles.h" 30 #include "neverhood/graphics.h" 31 32 namespace Video { 33 class SmackerDecoder; 34 } 35 36 namespace Neverhood { 37 38 struct RenderItem { 39 const Graphics::Surface *_surface; 40 const Graphics::Surface *_shadowSurface; 41 int16 _destX, _destY; 42 int16 _srcX, _srcY, _width, _height; 43 bool _transparent; 44 byte _version; 45 bool _refresh; 46 bool operator==(const RenderItem &second) const { 47 return 48 _surface == second._surface && 49 _shadowSurface == second._shadowSurface && 50 _destX == second._destX && 51 _destY == second._destY && 52 _srcX == second._srcX && 53 _srcY == second._srcY && 54 _width == second._width && 55 _height == second._height && 56 _transparent == second._transparent && 57 _version == second._version; 58 } 59 }; 60 61 typedef Common::Array<RenderItem> RenderQueue; 62 63 class Screen { 64 public: 65 Screen(NeverhoodEngine *vm); 66 ~Screen(); 67 void update(); 68 uint32 getNextFrameTime(); 69 void saveParams(); 70 void restoreParams(); 71 void setFps(int fps); 72 int getFps(); 73 void setYOffset(int16 yOffset); 74 int16 getYOffset(); 75 void setPaletteData(byte *paletteData); 76 void unsetPaletteData(byte *paletteData); getPaletteData()77 byte *getPaletteData() { return _paletteData; } 78 void testPalette(byte *paletteData); 79 void updatePalette(); 80 void clear(); 81 void clearRenderQueue(); 82 void drawSurface2(const Graphics::Surface *surface, NDrawRect &drawRect, NRect &clipRect, bool transparent, byte version, 83 const Graphics::Surface *shadowSurface = NULL); 84 void drawSurface3(const Graphics::Surface *surface, int16 x, int16 y, NDrawRect &drawRect, NRect &clipRect, bool transparent, byte version); 85 void drawDoubleSurface2(const Graphics::Surface *surface, NDrawRect &drawRect); 86 void drawUnk(const Graphics::Surface *surface, NDrawRect &drawRect, NDrawRect &sysRect, NRect &clipRect, bool transparent, byte version); 87 void drawSurfaceClipRects(const Graphics::Surface *surface, NDrawRect &drawRect, NRect *clipRects, uint clipRectsCount, bool transparent, byte version); setSmackerDecoder(Video::SmackerDecoder * smackerDecoder)88 void setSmackerDecoder(Video::SmackerDecoder *smackerDecoder) { _smackerDecoder = smackerDecoder; } 89 void queueBlit(const Graphics::Surface *surface, int16 destX, int16 destY, NRect &ddRect, bool transparent, byte version, 90 const Graphics::Surface *shadowSurface = NULL); 91 void blitRenderItem(const RenderItem &renderItem, const Common::Rect &clipRect); 92 protected: 93 NeverhoodEngine *_vm; 94 MicroTileArray *_microTiles; 95 Graphics::Surface *_backScreen; 96 Video::SmackerDecoder *_smackerDecoder, *_savedSmackerDecoder; 97 int32 _ticks; 98 int32 _frameDelay, _savedFrameDelay; 99 byte *_paletteData; 100 bool _paletteChanged; 101 int16 _yOffset, _savedYOffset; 102 bool _fullRefresh; 103 RenderQueue *_renderQueue, *_prevRenderQueue; 104 }; 105 106 } // End of namespace Neverhood 107 108 #endif /* NEVERHOOD_SCREEN_H */ 109