ScummVM API documentation
screen_lok.h
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 modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (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, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef KYRA_SCREEN_LOK_H
23 #define KYRA_SCREEN_LOK_H
24 
25 #include "kyra/graphics/screen.h"
26 
27 namespace Kyra {
28 
29 class KyraEngine_LoK;
30 
31 class Screen_LoK : public Screen {
32 public:
33  Screen_LoK(KyraEngine_LoK *vm, OSystem *system);
34  ~Screen_LoK() override;
35 
36  bool init() override;
37 
38  void loadBitmap(const char *filename, int tempPage, int dstPage, Palette *pal, bool skip = false) override;
39 
40  int getRectSize(int w, int h) override;
41 
42  void setTextColorMap(const uint8 *cmap) override;
43 
44  void fadeSpecialPalette(int palIndex, int startIndex, int size, int fadeTime);
45 
46  void savePageToDisk(const char *file, int page);
47  void loadPageFromDisk(const char *file, int page);
48  void queryPageFromDisk(const char *file, int page, uint8 *buffer);
49  void deletePageFromDisk(int page);
50 
51  void copyBackgroundBlock(int x, int page, int flag);
52  void copyBackgroundBlock2(int x);
53 
54  void addBitBlitRect(int x, int y, int w, int h);
55  void bitBlitRects();
56 
57  // AMIGA specific
58  void setInterfacePalette(const Palette &pal, uint8 r, uint8 g, uint8 b);
59  void postProcessCursor(uint8 *data, int width, int height, int pitch) override;
60 
61 protected:
62  enum {
63  kNumBitBlitRects = 10
64  };
65 
66  KyraEngine_LoK *_vm;
67 
68  static const ScreenDim _screenDimTable[];
69  static const int _screenDimTableCount;
70 
71  Common::Rect _bitBlitRects[kNumBitBlitRects];
72  int _bitBlitNum;
73  uint8 *_unkPtr1, *_unkPtr2;
74 
75  uint8 *_saveLoadPage[8];
76  uint8 *_saveLoadPageOvl[8];
77 };
78 
79 class Screen_LoK_16 : public Screen_LoK {
80 public:
81  Screen_LoK_16(KyraEngine_LoK *vm, OSystem *system);
82 
83  void setScreenPalette(const Palette &pal) override;
84 
85  void fadePalette(const Palette &pal, int delay, const UpdateFunctor *upFunc = 0) override;
86  void getFadeParams(const Palette &pal, int delay, int &delayInc, int &diff) override;
87  int fadePalStep(const Palette &pal, int diff) override;
88 private:
89  void updateDirtyRectsOvl();
90 
91  void convertTo16Colors(uint8 *page, int w, int h, int pitch, int keyColor = -1);
92  void postProcessCursor(uint8 *data, int width, int height, int pitch) override {
93  convertTo16Colors(data, width, height, pitch, _cursorColorKey);
94  }
95  void mergeOverlay(int x, int y, int w, int h) override;
96 
97  void set16ColorPalette(const uint8 *pal);
98 
99  void paletteMap(uint8 idx, int r, int g, int b);
100 
101  struct PaletteDither {
102  uint8 bestMatch;
103  uint8 invertMatch;
104  };
105 
106  PaletteDither _paletteDither[256];
107 
108  static const uint8 _palette16[48];
109 };
110 
111 } // End of namespace Kyra
112 
113 #endif
Definition: screen_lok.h:79
Definition: screen.h:565
Definition: rect.h:144
Definition: kyra_lok.h:97
Definition: screen.h:444
Definition: screen_lok.h:31
Definition: detection.h:27
Definition: screen.h:47
Definition: system.h:161