aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra/screen_lol.h
blob: e455976d76c6b9cd67d7ef382acb79b55849fe74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/* ScummVM - Graphic Adventure Engine
 *
 * ScummVM is the legal property of its developers, whose names
 * are too numerous to list here. Please refer to the COPYRIGHT
 * file distributed with this source distribution.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.

 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 * $URL$
 * $Id$
 *
 */

#ifdef ENABLE_LOL

#ifndef KYRA_SCREEN_LOL_H
#define KYRA_SCREEN_LOL_H

#include "kyra/screen_v2.h"

namespace Kyra {

class LoLEngine;

class Screen_LoL : public Screen_v2 {
public:
	Screen_LoL(LoLEngine *vm, OSystem *system);
	~Screen_LoL();

	bool init();

	void setScreenDim(int dim);
	const ScreenDim *getScreenDim(int dim);
	int curDimIndex() { return _curDimIndex; }
	void modifyScreenDim(int dim, int x, int y, int w, int h);

	void fprintString(const char *format, int x, int y, uint8 col1, uint8 col2, uint16 flags, ...) GCC_PRINTF(2, 8);
	void fprintStringIntro(const char *format, int x, int y, uint8 c1, uint8 c2, uint8 c3, uint16 flags, ...) GCC_PRINTF(2, 9);

	void drawShadedBox(int x1, int y1, int x2, int y2, int color1, int color2);

	void drawGridBox(int x, int y, int w, int h, int col);
	void fadeClearSceneWindow(int delay);

	// smooth scrolling
	void backupSceneWindow(int srcPageNum, int dstPageNum);
	void restoreSceneWindow(int srcPageNum, int dstPageNum);
	void clearGuiShapeMemory(int pageNum);
	void copyGuiShapeFromSceneBackupBuffer(int srcPageNum, int dstPageNum);
	void copyGuiShapeToSurface(int srcPageNum, int dstPageNum);
	void smoothScrollZoomStepTop(int srcPageNum, int dstPageNum, int x, int y);
	void smoothScrollZoomStepBottom(int srcPageNum, int dstPageNum, int x, int y);
	void smoothScrollHorizontalStep(int pageNum, int x, int u2, int w);
	void smoothScrollTurnStep1(int srcPage1Num, int srcPage2Num, int dstPageNum);
	void smoothScrollTurnStep2(int srcPage1Num, int srcPage2Num, int dstPageNum);
	void smoothScrollTurnStep3(int srcPage1Num, int srcPage2Num, int dstPageNum);

	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, ...);

	// palette stuff
	void fadeToBlack(int delay=0x54, const UpdateFunctor *upFunc = 0);
	void fadeToPalette1(int delay);
	void loadSpecialColors(Palette &dst);
	void copyColor(int dstColorIndex, int srcColorIndex);
	bool fadeColor(int dstColorIndex, int srcColorIndex, uint32 elapsedTime, uint32 targetTime);
	bool fadePaletteStep(uint8 *pal1, uint8 *pal2, uint32 elapsedTime, uint32 targetTime);
	Palette **generateFadeTable(Palette **dst, Palette *src1, Palette *src2, int numTabs);

	void generateGrayOverlay(const Palette &Pal, uint8 *grayOverlay, int factor, int addR, int addG, int addB, int lastColor, bool skipSpecialColors);
	uint8 *generateLevelOverlay(const Palette &Pal, uint8 *ovl, int opColor, int weight);
	uint8 *getLevelOverlay(int index) { return _levelOverlays[index]; }

	void generateTruelightTables(const uint8 *ovl, int a, const Palette &fxPal, const Palette &screenPal, uint8 *outTable1, uint8 *outTable2, int b);

	void copyBlockAndApplyOverlay(int page1, int x1, int y1, int page2, int x2, int y2, int w, int h, int dim, uint8 *ovl);
	void applyOverlaySpecial(int page1, int x1, int y1, int page2, int x2, int y2, int w, int h, int dim, int flag, uint8 *ovl);

	void copyBlockAndApplyOverlayOutro(int srcPage, int dstPage, const uint8 *ovl);

	uint8 getShapePaletteSize(const uint8 *shp);

	uint8 *_paletteOverlay1;
	uint8 *_paletteOverlay2;
	uint8 *_grayOverlay;
	int _fadeFlag;

	// PC98 specific
	static void convertPC98Gfx(uint8 *data, int w, int h, int pitch);

private:
	LoLEngine *_vm;

	const ScreenDim *_screenDimTable;
	static const int _screenDimTableCount;

	static const ScreenDim _screenDimTable256C[];
	static const ScreenDim _screenDimTable16C[];

	ScreenDim **_customDimTable;
	int _curDimIndex;

	uint8 *_levelOverlays[8];

	void mergeOverlay(int x, int y, int w, int h);
	void postProcessCursor(uint8 *data, int width, int height, int pitch);
};

} // End of namespace Kyra

#endif

#endif // ENABLE_LOL