ScummVM API documentation
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 MADS_CORE_PAL_H
23#define MADS_CORE_PAL_H
24
25#include "mads/core/general.h"
26#include "mads/core/color.h"
27
28namespace MADS {
29
30/* Palette mapping options to be passed to pal_allocate */
31
32#define PAL_MAP_BACKGROUND 0x8000 /* Loading initial background */
33#define PAL_MAP_RESERVED 0x4000 /* Allow mapping of reserved colors */
34#define PAL_MAP_ANY_TO_CLOSEST 0x2000 /* Any color can map to closest */
35#define PAL_MAP_ALL_TO_CLOSEST 0x1000 /* Any colors that can map must map */
36#define PAL_MAP_TOP_COLORS 0x0800 /* Allow mapping to top four colors */
37#define PAL_MAP_DEFINE_RESERVED 0x0400 /* Define initial reserved color */
38
39#define PAL_MAP_MASK 0xfc00 /* Mask for all palette flags on, */
40 /* so that a routine can accept PAL */
41 /* flags along with other flags of */
42 /* its own in the same register, & */
43 /* then forward a clean copy of the */
44 /* PAL flags to pal_allocate(). */
45
46
47#define PAL_FORCE_SHADOW 240
48
49/* Internal facts */
50
51#define PAL_MAXFLAGS 0x20 /* Number of available flags */
52
53#define PAL_RESERVED 0x0001 /* ... 0001 */
54#define PAL_CYCLE 0x0002 /* ... 0010 */
55
56
57/* Returned by pal_deallocate */
58
59#define PAL_ERR_BADFLAG -1 /* Flag number out of range */
60#define PAL_ERR_FLAGNOTUSED -2 /* Attempt to clear unused flag */
61
62
63/* Returned by pal_allocate */
64
65#define PAL_ERR_OUTOFFLAGS -10 /* No available usage flags */
66#define PAL_ERR_OUTOFCOLORS -11 /* Not enough available colors */
67
68
69/* Data available to system: */
70
71extern Palette master_palette; /* Main global palette for program */
72extern ShadowListPtr master_shadow; /* Main global shadow color list */
73
74extern dword color_status[256]; /* Mapping status of each palette color */
75extern int flag_used[PAL_MAXFLAGS];/* Mapping status of each palette handle*/
76
77extern int palette_locked;
78
79extern int palette_low_search_limit; /* Artificial search boundaries */
80extern int palette_high_search_limit;
81
82extern void (*pal_manager_update)();
83extern int pal_manager_active;
84extern int pal_manager_colors;
85
86
92extern void pal_init(int reserve_bottom, int reserve_top);
93
94extern void pal_lock();
95extern void pal_unlock();
96
122extern int pal_allocate(ColorListPtr new_list, ShadowListPtr shadow_list, int pal_flags);
123
133extern int pal_deallocate(int use_flag);
134
139extern void pal_compact(int16 master_handle, int num_slaves, int16 *slave);
140
144extern int pal_get_hash(RGBcolor *one, RGBcolor *two);
145
149extern void pal_shadow_sort(ShadowListPtr shadow, ColorListPtr list);
150
154extern void pal_init_shadow(ShadowListPtr shadow, ColorListPtr new_list);
155extern void pal_activate_shadow(ShadowListPtr shadow);
156
160extern int pal_get_flags();
161
165extern int pal_get_colors();
166extern void pal_interface(Palette &fixpal);
167extern void pal_white(Palette &fixpal);
168extern void pal_grey(Palette &fixpal, int base_color, int num_colors,
169 int low_grey, int high_grey);
170extern int pal_get_color(RGBcolor color, int color_handle,
171 int override_reserved, int *color_number);
172extern void pal_change_color(int color, int r, int g, int b);
173
174extern void init_pal();
175
180extern int pal_alloc_color(int slot, int allow_shared, int *out_index, const RGBcolor *color);
181
182} // namespace MADS
183
184#endif
Definition: atari-screen.h:42