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 #ifdef ENABLE_LOL
24 
25 #ifndef KYRA_SCREEN_LOL_H
26 #define KYRA_SCREEN_LOL_H
27 
28 #include "kyra/graphics/screen_v2.h"
29 
30 namespace Kyra {
31 
32 class LoLEngine;
33 
34 class Screen_LoL : public Screen_v2 {
35 public:
36 	Screen_LoL(LoLEngine *vm, OSystem *system);
37 	~Screen_LoL() override;
38 
39 	void fprintString(const char *format, int x, int y, uint8 col1, uint8 col2, uint flags, ...) GCC_PRINTF(2, 8);
40 	void fprintStringIntro(const char *format, int x, int y, uint8 c1, uint8 c2, uint8 c3, uint flags, ...) GCC_PRINTF(2, 9);
41 
42 	void drawShadedBox(int x1, int y1, int x2, int y2, int color1, int color2) override;
43 
44 	void drawGridBox(int x, int y, int w, int h, int col);
45 	void fadeClearSceneWindow(int delay);
46 
47 	// smooth scrolling
48 	void backupSceneWindow(int srcPageNum, int dstPageNum);
49 	void restoreSceneWindow(int srcPageNum, int dstPageNum);
50 	void clearGuiShapeMemory(int pageNum);
51 	void copyGuiShapeFromSceneBackupBuffer(int srcPageNum, int dstPageNum);
52 	void copyGuiShapeToSurface(int srcPageNum, int dstPageNum);
53 	void smoothScrollZoomStepTop(int srcPageNum, int dstPageNum, int x, int y);
54 	void smoothScrollZoomStepBottom(int srcPageNum, int dstPageNum, int x, int y);
55 	void smoothScrollHorizontalStep(int pageNum, int x, int u2, int w);
56 	void smoothScrollTurnStep1(int srcPage1Num, int srcPage2Num, int dstPageNum);
57 	void smoothScrollTurnStep2(int srcPage1Num, int srcPage2Num, int dstPageNum);
58 	void smoothScrollTurnStep3(int srcPage1Num, int srcPage2Num, int dstPageNum);
59 
60 	void copyRegionSpecial(int page1, int w1, int h1, int x1, int y1, int page2, int w2, int h2, int x2, int y2, int w3, int h3, int mode, ...);
61 
62 	// palette stuff
63 	void fadeToBlack(int delay=0x54, const UpdateFunctor *upFunc = 0);
64 	void fadeToPalette1(int delay);
65 	void loadSpecialColors(Palette &dst);
66 	void copyColor(int dstColorIndex, int srcColorIndex);
67 	bool fadeColor(int dstColorIndex, int srcColorIndex, uint32 elapsedTicks, uint32 totalTicks);
68 	Palette **generateFadeTable(Palette **dst, Palette *src1, Palette *src2, int numTabs);
69 
70 	void generateGrayOverlay(const Palette &Pal, uint8 *grayOverlay, int factor, int addR, int addG, int addB, int lastColor, bool skipSpecialColors);
getLevelOverlay(int index)71 	uint8 *getLevelOverlay(int index) { return _levelOverlays[index]; }
72 
73 	void createTransparencyTablesIntern(const uint8 *ovl, int a, const uint8 *fxPal1, const uint8 *fxPal2, uint8 *outTable1, uint8 *outTable2, int b);
74 
75 	void copyBlockAndApplyOverlay(int page1, int x1, int y1, int page2, int x2, int y2, int w, int h, int dim, uint8 *ovl);
76 	void applyOverlaySpecial(int page1, int x1, int y1, int page2, int x2, int y2, int w, int h, int dim, int flag, uint8 *ovl);
77 
78 	void copyBlockAndApplyOverlayOutro(int srcPage, int dstPage, const uint8 *ovl);
79 
80 	uint8 getShapePaletteSize(const uint8 *shp);
81 
82 	uint8 *_paletteOverlay1;
83 	uint8 *_paletteOverlay2;
84 	uint8 *_grayOverlay;
85 	int _fadeFlag;
86 
87 	// PC98 specific
88 	static void convertPC98Gfx(uint8 *data, int w, int h, int pitch);
89 
90 private:
91 	static const ScreenDim _screenDimTable256C[];
92 	static const ScreenDim _screenDimTable16C[];
93 	static const int _screenDimTableCount;
94 
95 	uint8 *_levelOverlays[8];
96 
97 	void mergeOverlay(int x, int y, int w, int h) override;
98 	void postProcessCursor(uint8 *data, int width, int height, int pitch) override;
99 };
100 
101 } // End of namespace Kyra
102 
103 #endif
104 
105 #endif // ENABLE_LOL
106