2018-11-05 07:28:01 +00:00
|
|
|
// "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman
|
|
|
|
// Ken Silverman's official web site: "http://www.advsys.net/ken"
|
|
|
|
// See the included license file "BUILDLIC.TXT" for license info.
|
|
|
|
//
|
|
|
|
// This file has been modified from Ken Silverman's original release
|
|
|
|
// by Jonathon Fowler (jf@jonof.id.au)
|
|
|
|
// by the EDuke32 team (development@voidpoint.com)
|
|
|
|
|
2016-06-21 00:33:06 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#ifndef palette_h_
|
|
|
|
#define palette_h_
|
|
|
|
|
2019-12-29 20:36:21 +00:00
|
|
|
#include "renderstyle.h"
|
2020-04-11 21:54:33 +00:00
|
|
|
#include "filesystem.h"
|
2020-05-23 12:36:35 +00:00
|
|
|
#include "zstring.h"
|
|
|
|
#include "palentry.h"
|
|
|
|
#include "templates.h"
|
2019-03-01 08:51:50 +00:00
|
|
|
|
2016-06-21 00:33:06 +00:00
|
|
|
#define MAXBASEPALS 256
|
|
|
|
#define MAXPALOOKUPS 256
|
|
|
|
#define MAXBLENDTABS 256
|
|
|
|
|
|
|
|
#define RESERVEDPALS 4 // don't forget to increment this when adding reserved pals
|
|
|
|
#define DETAILPAL (MAXPALOOKUPS - 1)
|
|
|
|
#define GLOWPAL (MAXPALOOKUPS - 2)
|
|
|
|
#define SPECULARPAL (MAXPALOOKUPS - 3)
|
|
|
|
#define NORMALPAL (MAXPALOOKUPS - 4)
|
2019-10-17 18:29:58 +00:00
|
|
|
#define BRIGHTPAL (MAXPALOOKUPS)
|
2016-06-21 00:33:06 +00:00
|
|
|
|
2020-05-23 12:40:54 +00:00
|
|
|
extern FString LookupTables[MAXPALOOKUPS];
|
|
|
|
|
2020-04-12 05:50:24 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
Translation_BasePalettes,
|
|
|
|
Translation_Remap,
|
|
|
|
};
|
|
|
|
|
2016-06-21 00:33:06 +00:00
|
|
|
extern uint8_t curbasepal;
|
2020-05-23 12:40:54 +00:00
|
|
|
extern FixedBitArray<256> FullbrightIndices;
|
2020-05-23 12:36:35 +00:00
|
|
|
extern int32_t r_scenebrightness;
|
2016-06-21 00:33:06 +00:00
|
|
|
|
2019-11-10 20:11:17 +00:00
|
|
|
struct palette_t
|
|
|
|
{
|
2019-09-22 21:15:46 +00:00
|
|
|
uint8_t r, g, b, f;
|
2019-11-10 20:11:17 +00:00
|
|
|
};
|
2018-04-12 21:02:31 +00:00
|
|
|
|
2020-05-23 12:40:54 +00:00
|
|
|
extern PalEntry palfadergb;
|
|
|
|
|
2018-04-12 21:03:12 +00:00
|
|
|
void paletteMakeLookupTable(int32_t palnum, const char *remapbuf, uint8_t r, uint8_t g, uint8_t b, char noFloorPal);
|
2020-05-23 12:40:54 +00:00
|
|
|
void paletteSetColorTable(int32_t id, uint8_t const* table, bool notransparency, bool twodonly);
|
2018-04-12 21:03:12 +00:00
|
|
|
int32_t paletteSetLookupTable(int32_t palnum, const uint8_t *shtab);
|
2020-01-26 09:58:00 +00:00
|
|
|
|
|
|
|
#include "tflags.h"
|
|
|
|
enum ESetPalFlag
|
|
|
|
{
|
|
|
|
Pal_DontResetFade = 1,
|
|
|
|
};
|
|
|
|
|
2020-05-23 12:36:35 +00:00
|
|
|
inline void videoSetBrightness(int brightness)
|
|
|
|
{
|
|
|
|
r_scenebrightness = clamp(brightness, 0, 15);
|
|
|
|
}
|
|
|
|
|
2020-01-26 09:58:00 +00:00
|
|
|
typedef TFlags<ESetPalFlag> ESetPalFlags;
|
|
|
|
DEFINE_TFLAGS_OPERATORS(ESetPalFlags)
|
|
|
|
|
|
|
|
void videoSetPalette(int dabrightness, int dapalid, ESetPalFlags flags);
|
2020-05-23 12:40:54 +00:00
|
|
|
inline void videoFadePalette(uint8_t r, uint8_t g, uint8_t b, uint8_t offset)
|
|
|
|
{
|
|
|
|
palfadergb.r = r;
|
|
|
|
palfadergb.g = g;
|
|
|
|
palfadergb.b = b;
|
|
|
|
palfadergb.a = offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-09-19 20:02:45 +00:00
|
|
|
#ifdef USE_OPENGL
|
|
|
|
void videoTintBlood(int32_t r, int32_t g, int32_t b);
|
|
|
|
#endif
|
2016-06-21 00:33:06 +00:00
|
|
|
|
2018-10-16 06:09:09 +00:00
|
|
|
extern int32_t globalpal;
|
2016-06-21 00:33:06 +00:00
|
|
|
extern int32_t globalblend;
|
2018-04-12 21:03:12 +00:00
|
|
|
extern void paletteLoadFromDisk(void);
|
|
|
|
extern void palettePostLoadTables(void);
|
2016-06-21 00:33:06 +00:00
|
|
|
|
2019-10-20 20:26:53 +00:00
|
|
|
extern int32_t paletteLoadLookupTable(FileReader &fp);
|
2018-04-12 21:03:12 +00:00
|
|
|
extern void paletteSetupDefaultFog(void);
|
2019-12-25 10:26:19 +00:00
|
|
|
void paletteFreeLookups();
|
2018-04-12 21:03:12 +00:00
|
|
|
extern void palettePostLoadLookups(void);
|
|
|
|
extern void paletteFixTranslucencyMask(void);
|
2016-06-21 00:33:06 +00:00
|
|
|
|
|
|
|
extern int8_t g_noFloorPal[MAXPALOOKUPS];
|
|
|
|
|
|
|
|
extern char britable[16][256];
|
|
|
|
|
|
|
|
#ifdef USE_OPENGL
|
|
|
|
extern palette_t palookupfog[MAXPALOOKUPS];
|
|
|
|
|
2016-10-09 07:55:23 +00:00
|
|
|
typedef struct glblenddef_
|
|
|
|
{
|
|
|
|
float alpha;
|
|
|
|
uint8_t src, dst, flags;
|
|
|
|
} glblenddef_t;
|
|
|
|
|
|
|
|
typedef struct glblend_
|
|
|
|
{
|
|
|
|
glblenddef_t def[2];
|
|
|
|
} glblend_t;
|
|
|
|
|
|
|
|
extern glblend_t const nullglblend, defaultglblend;
|
|
|
|
extern glblend_t glblend[MAXBLENDTABS];
|
|
|
|
|
2020-05-23 12:40:54 +00:00
|
|
|
FRenderStyle GetRenderStyle(int blend, int def);
|
|
|
|
extern void SetRenderStyleFromBlend(uint8_t enable, uint8_t blend, uint8_t def);
|
|
|
|
float GetAlphaFromBlend(uint32_t maskprops, uint32_t blend);
|
2019-12-29 20:36:21 +00:00
|
|
|
|
2016-06-21 00:33:06 +00:00
|
|
|
#endif
|
|
|
|
|
2016-12-26 06:02:01 +00:00
|
|
|
#endif
|