You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
79 lines
2.1 KiB
79 lines
2.1 KiB
|
6 years ago
|
/**
|
||
|
|
* @file palette.h
|
||
|
|
*
|
||
|
|
* Interface of functions for handling the engines color palette.
|
||
|
|
*/
|
||
|
5 years ago
|
#pragma once
|
||
|
8 years ago
|
|
||
|
4 years ago
|
#include <cstdint>
|
||
|
|
|
||
|
4 years ago
|
#include "levels/gendung.h"
|
||
|
5 years ago
|
|
||
|
5 years ago
|
namespace devilution {
|
||
|
6 years ago
|
|
||
|
5 years ago
|
// Diablo uses a 256 color palette
|
||
|
|
// Entry 0-127 (0x00-0x7F) are level specific
|
||
|
|
// Entry 128-255 (0x80-0xFF) are global
|
||
|
|
|
||
|
|
// standard palette for all levels
|
||
|
|
// 8 or 16 shades per color
|
||
|
|
// example (dark blue): PAL16_BLUE+14, PAL8_BLUE+7
|
||
|
|
// example (light red): PAL16_RED+2, PAL8_RED
|
||
|
|
// example (orange): PAL16_ORANGE+8, PAL8_ORANGE+4
|
||
|
|
#define PAL8_BLUE 128
|
||
|
|
#define PAL8_RED 136
|
||
|
|
#define PAL8_YELLOW 144
|
||
|
|
#define PAL8_ORANGE 152
|
||
|
|
#define PAL16_BEIGE 160
|
||
|
|
#define PAL16_BLUE 176
|
||
|
|
#define PAL16_YELLOW 192
|
||
|
|
#define PAL16_ORANGE 208
|
||
|
|
#define PAL16_RED 224
|
||
|
|
#define PAL16_GRAY 240
|
||
|
|
|
||
|
6 years ago
|
extern SDL_Color logical_palette[256];
|
||
|
|
extern SDL_Color system_palette[256];
|
||
|
|
extern SDL_Color orig_palette[256];
|
||
|
5 years ago
|
/** Lookup table for transparency */
|
||
|
5 years ago
|
extern Uint8 paletteTransparencyLookup[256][256];
|
||
|
8 years ago
|
|
||
|
4 years ago
|
#if DEVILUTIONX_PALETTE_TRANSPARENCY_BLACK_16_LUT
|
||
|
4 years ago
|
/**
|
||
|
|
* A lookup table from black for a pair of colors.
|
||
|
|
*
|
||
|
|
* For a pair of colors i and j, the index `i | (j << 8)` contains
|
||
|
|
* `paletteTransparencyLookup[0][i] | (paletteTransparencyLookup[0][j] << 8)`.
|
||
|
|
*
|
||
|
|
* On big-endian platforms, the indices are encoded as `j | (i << 8)`, while the
|
||
|
|
* value order remains the same.
|
||
|
|
*/
|
||
|
|
extern uint16_t paletteTransparencyLookupBlack16[65536];
|
||
|
4 years ago
|
#endif
|
||
|
4 years ago
|
|
||
|
5 years ago
|
void palette_update(int first = 0, int ncolor = 256);
|
||
|
7 years ago
|
void palette_init();
|
||
|
5 years ago
|
void LoadPalette(const char *pszFileName, bool blend = true);
|
||
|
5 years ago
|
void LoadRndLvlPal(dungeon_type l);
|
||
|
7 years ago
|
void IncreaseGamma();
|
||
|
6 years ago
|
void ApplyGamma(SDL_Color *dst, const SDL_Color *src, int n);
|
||
|
7 years ago
|
void DecreaseGamma();
|
||
|
|
int UpdateGamma(int gamma);
|
||
|
|
void BlackPalette();
|
||
|
5 years ago
|
void SetFadeLevel(int fadeval);
|
||
|
5 years ago
|
/**
|
||
|
|
* @brief Fade screen from black
|
||
|
|
* @param fr Steps per 50ms
|
||
|
|
*/
|
||
|
7 years ago
|
void PaletteFadeIn(int fr);
|
||
|
5 years ago
|
/**
|
||
|
|
* @brief Fade screen to black
|
||
|
|
* @param fr Steps per 50ms
|
||
|
|
*/
|
||
|
7 years ago
|
void PaletteFadeOut(int fr);
|
||
|
|
void palette_update_caves();
|
||
|
6 years ago
|
void palette_update_crypt();
|
||
|
|
void palette_update_hive();
|
||
|
7 years ago
|
void palette_update_quest_palette(int n);
|
||
|
8 years ago
|
|
||
|
5 years ago
|
} // namespace devilution
|