ScummVM API documentation
krn_pal.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 M4_GRAPHICS_KRN_PAL_H
23 #define M4_GRAPHICS_KRN_PAL_H
24 
25 #include "m4/m4_types.h"
26 #include "m4/adv_r/adv_hotspot.h"
27 #include "m4/wscript/ws_machine.h"
28 
29 namespace M4 {
30 
31 #define TO_GREY (int32)0
32 #define TO_COLOR (int32)1
33 #define TO_BLACK (int32)2
34 
36  RGB8 _myFXPalette[256];
37 
38  bool _myCycleReq = false;
39  bool _myCycleFinished = true;
40  bool _myCycleDACrefresh = false;
41  int32 _myCycleDelayTicks = 6; // 10 times a second
42  int32 _myCycleStartTime = 0;
43  int32 _myCycleEndTime = 0;
44  int32 _myCycleEndDelayTime = 0;
45  int32 _myCycleStartIndex = 0;
46  int32 _myCycleEndIndex = 0;
47  int32 _myCycleTrigger = 0;
48  int32 _myCycleNeverStopCycling = false;
49 
50  bool _myFadeReq = false;
51  bool _myFadeFinished = true;
52  bool _myFadeDACrefresh = false;
53  int32 _myFadeDelayTicks = 3; // 20 times a second
54  int32 _myFadeStartTime = 0;
55  int32 _myFadeEndTime = 0;
56  int32 _myFadeEndDelayTime = 0;
57  int32 _myFadeStartIndex = 0;
58  int32 _myFadeEndIndex = 0;
59  int32 _myFadeTrigger = 0;
60  frac16 _myFadeStartPercentFrac = 0x10000;
61  frac16 _myFadeCurrPercentFrac = 0x10000;
62  frac16 _myFadePercentFrac = 0;
63 
64  HotSpotRec *_exam_saved_hotspots = nullptr;
65 
66  RGB8 *_fadeToMe = nullptr;
67  RGB8 *_trick = nullptr;
68  RGB8 *_picPal = nullptr;
69  int32 _seriesHash = 0;
70  machine *_seriesAnim8 = nullptr;
71  uint8 _translation[32]; // Only 32 greys in ramp
72 
73  int32 _colorAreaX1 = -1;
74  int32 _colorAreaY1 = -1;
75  int32 _colorAreaX2 = -1;
76  int32 _colorAreaY2 = -1;
77 
78  int32 _greyAreaX1 = -1;
79  int32 _greyAreaY1 = -1;
80  int32 _greyAreaX2 = -1;
81  int32 _greyAreaY2 = -1;
82 
83  bool _greyVideoMode = false;
84 };
85 
86 void pal_fade_set_start(RGB8 *origPalette, int32 percent);
87 void pal_fade_set_start(int32 percent);
88 void pal_fade_init(RGB8 *origPalette, int32 firstPalEntry, int32 lastPalEntry, int32 targetPercent, int32 numTicks, int32 triggerNum);
89 void pal_fade_init(int32 firstPalEntry, int32 lastPalEntry, int32 targetPercent, int32 numTicks, int32 triggerNum);
90 
91 void disable_player_commands_and_fade_init(int trigger);
92 void pal_cycle_init(int32 firstPalEntry, int32 lastPalEntry, int32 delayTicks,
93  int32 totalTicks = -1, int32 triggerNum = -1);
94 
98 bool pal_cycle_active();
99 
103 void pal_cycle_stop();
104 
108 void pal_cycle_resume();
109 
113 void pal_fx_update();
114 
119 void DAC_tint_range(const RGB8 *tintColor, int32 percent, int32 firstPalEntry, int32 lastPalEntry, bool transparent);
120 
121 void kernel_examine_inventory_object(const char *picName, RGB8 *pal,
122  int steps, int delay, int32 x, int32 y, int32 trigger,
123  const char *digiName, int32 digiTrigger);
124 void kernel_examine_inventory_object(const char *picName, int steps, int delay,
125  int32 x, int32 y, int32 triggerNum, const char *digiName = nullptr, int32 digiTrigger = -1);
126 void kernel_unexamine_inventory_object(RGB8 *pal, int steps, int delay);
127 
128 void remap_buffer_with_luminance_map(Buffer *src, int32 x1, int32 y1, int32 x2, int32 y2);
129 void krn_SetGreyVideoMode(int32 grey_x1, int32 grey_y1, int32 grey_x2, int32 grey_y2, int32 color_x1, int32 color_y1, int32 color_x2, int32 color_y2);
130 void krn_UnsetGreyVideoMode(void);
131 bool krn_GetGreyMode(void);
132 void krn_UpdateGreyArea(Buffer *greyOutThisBuffer, int32 scrnX, int32 scrnY,
133  int32 greyX1, int32 greyY1, int32 greyX2, int32 greyY2);
134 void krn_ChangeBufferLuminance(Buffer *target, int32 percent);
135 
136 void krn_pal_game_task();
137 void krn_fade_from_grey(RGB8 *pal, int32 steps, int32 delay, int32 fadeType);
138 void krn_fade_to_grey(RGB8 *pal, int32 steps, int32 delay);
139 
140 } // namespace M4
141 
142 #endif
Definition: ws_machine.h:153
void DAC_tint_range(const RGB8 *tintColor, int32 percent, int32 firstPalEntry, int32 lastPalEntry, bool transparent)
intptr frac16
Definition: m4_types.h:46
Definition: m4_types.h:88
Definition: m4_types.h:67
void pal_fx_update()
Definition: database.h:28
bool pal_cycle_active()
void pal_cycle_stop()
void pal_cycle_resume()
Definition: adv_hotspot.h:30
Definition: krn_pal.h:35