2008-12-02 10:44:39 +00:00
|
|
|
#ifndef HIGHTILE_PRIV_H
|
|
|
|
#define HIGHTILE_PRIV_H
|
|
|
|
|
2014-11-26 04:39:23 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2008-12-02 10:44:39 +00:00
|
|
|
struct hicskybox_t {
|
|
|
|
char *face[6];
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct hicreplc_t {
|
|
|
|
struct hicreplc_t *next;
|
|
|
|
char *filename;
|
|
|
|
struct hicskybox_t *skybox;
|
2014-10-25 03:36:34 +00:00
|
|
|
vec2f_t scale;
|
|
|
|
float alphacut, specpower, specfactor;
|
2014-09-30 04:06:05 +00:00
|
|
|
char palnum, flags;
|
2008-12-02 10:44:39 +00:00
|
|
|
} hicreplctyp;
|
|
|
|
|
2017-06-21 13:46:44 +00:00
|
|
|
typedef struct {
|
|
|
|
polytintflags_t f;
|
|
|
|
uint8_t r, g, b;
|
|
|
|
} polytint_t;
|
|
|
|
|
|
|
|
extern polytint_t hictinting[MAXPALOOKUPS];
|
2008-12-02 10:44:39 +00:00
|
|
|
extern hicreplctyp *hicreplc[MAXTILES];
|
2014-09-30 04:06:05 +00:00
|
|
|
extern int32_t hicinitcounter;
|
2008-12-02 10:44:39 +00:00
|
|
|
|
2009-01-21 22:43:44 +00:00
|
|
|
typedef struct texcachehead_t
|
2008-12-02 10:44:39 +00:00
|
|
|
{
|
|
|
|
char magic[4]; // 'PMST', was 'Polymost'
|
|
|
|
int xdim, ydim; // of image, unpadded
|
|
|
|
int flags; // 1 = !2^x, 2 = has alpha, 4 = lzw compressed
|
|
|
|
int quality; // r_downsize at the time the cache was written
|
|
|
|
} texcacheheader;
|
|
|
|
|
2009-01-21 22:43:44 +00:00
|
|
|
typedef struct texcachepic_t
|
2008-12-02 10:44:39 +00:00
|
|
|
{
|
|
|
|
int size;
|
|
|
|
int format;
|
|
|
|
int xdim, ydim; // of mipmap (possibly padded)
|
|
|
|
int border, depth;
|
|
|
|
} texcachepicture;
|
|
|
|
|
2017-06-21 13:46:54 +00:00
|
|
|
hicreplctyp * hicfindsubst(int picnum, int palnum, int nozero = 0);
|
|
|
|
hicreplctyp * hicfindskybox(int picnum, int palnum, int nozero = 0);
|
2014-05-28 22:40:16 +00:00
|
|
|
|
2014-05-28 22:40:17 +00:00
|
|
|
static inline int have_basepal_tint(void)
|
|
|
|
{
|
2017-06-21 13:46:50 +00:00
|
|
|
polytint_t const & tint = hictinting[MAXPALOOKUPS-1];
|
|
|
|
return (tint.r != 255 ||
|
|
|
|
tint.g != 255 ||
|
|
|
|
tint.b != 255);
|
2014-05-28 22:40:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void hictinting_apply(float *color, int32_t palnum)
|
|
|
|
{
|
2017-06-21 13:46:50 +00:00
|
|
|
polytint_t const & tint = hictinting[palnum];
|
|
|
|
color[0] *= (float)tint.r * (1.f/255.f);
|
|
|
|
color[1] *= (float)tint.g * (1.f/255.f);
|
|
|
|
color[2] *= (float)tint.b * (1.f/255.f);
|
2014-05-28 22:40:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void hictinting_apply_ub(uint8_t *color, int32_t palnum)
|
|
|
|
{
|
2017-06-21 13:46:50 +00:00
|
|
|
polytint_t const & tint = hictinting[palnum];
|
|
|
|
color[0] = (uint8_t)(color[0] * (float)tint.r * (1.f/255.f));
|
|
|
|
color[1] = (uint8_t)(color[1] * (float)tint.g * (1.f/255.f));
|
|
|
|
color[2] = (uint8_t)(color[2] * (float)tint.b * (1.f/255.f));
|
2014-05-28 22:40:17 +00:00
|
|
|
}
|
|
|
|
|
2014-05-28 22:40:16 +00:00
|
|
|
// texcacheheader cachead.flags bits
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
CACHEAD_NONPOW2 = 1,
|
|
|
|
CACHEAD_HASALPHA = 2,
|
|
|
|
CACHEAD_COMPRESSED = 4,
|
2016-02-29 06:34:12 +00:00
|
|
|
CACHEAD_NODOWNSIZE = 8,
|
2016-05-04 00:25:17 +00:00
|
|
|
CACHEAD_HASFULLBRIGHT = 16,
|
|
|
|
CACHEAD_NPOTWALL = 32,
|
2014-05-28 22:40:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// hicreplctyp hicr->flags bits
|
|
|
|
enum
|
|
|
|
{
|
2016-02-29 06:34:12 +00:00
|
|
|
HICR_NOTEXCOMPRESS = 1,
|
2015-03-28 09:49:37 +00:00
|
|
|
HICR_FORCEFILTER = 2,
|
2014-05-28 22:40:16 +00:00
|
|
|
|
2016-02-29 06:34:12 +00:00
|
|
|
HICR_NODOWNSIZE = 16,
|
2016-03-07 11:21:55 +00:00
|
|
|
HICR_ARTIMMUNITY = 32,
|
2014-05-28 22:40:16 +00:00
|
|
|
};
|
|
|
|
|
2016-03-04 19:24:54 +00:00
|
|
|
// hictinting[].f / gloadtile_hi() and mdloadskin() <effect> arg bits
|
2014-05-28 22:40:16 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
HICTINT_GRAYSCALE = 1,
|
|
|
|
HICTINT_INVERT = 2,
|
|
|
|
HICTINT_COLORIZE = 4,
|
|
|
|
HICTINT_USEONART = 8,
|
2015-03-09 20:32:11 +00:00
|
|
|
HICTINT_APPLYOVERPALSWAP = 16,
|
|
|
|
HICTINT_APPLYOVERALTPAL = 32,
|
2014-05-28 22:40:16 +00:00
|
|
|
|
2015-04-14 08:08:02 +00:00
|
|
|
HICTINT_BLEND_MULTIPLY = 0<<6,
|
|
|
|
HICTINT_BLEND_SCREEN = 1<<6,
|
|
|
|
HICTINT_BLEND_OVERLAY = 2<<6,
|
|
|
|
HICTINT_BLEND_HARDLIGHT = 3<<6,
|
|
|
|
|
|
|
|
HICTINT_BLENDMASK = 64|128,
|
|
|
|
|
|
|
|
HICTINT_PRECOMPUTED = HICTINT_COLORIZE | HICTINT_BLENDMASK,
|
2015-04-14 21:17:36 +00:00
|
|
|
HICTINT_IN_MEMORY = HICTINT_PRECOMPUTED | HICTINT_GRAYSCALE | HICTINT_INVERT,
|
2015-04-14 08:08:02 +00:00
|
|
|
|
2017-06-21 13:46:36 +00:00
|
|
|
HICTINT_MEMORY_COMBINATIONS = 1<<5,
|
2014-05-28 22:40:16 +00:00
|
|
|
};
|
2008-12-02 10:44:39 +00:00
|
|
|
|
2015-01-11 04:51:41 +00:00
|
|
|
#define GRAYSCALE_COEFF_RED 0.3
|
|
|
|
#define GRAYSCALE_COEFF_GREEN 0.59
|
|
|
|
#define GRAYSCALE_COEFF_BLUE 0.11
|
|
|
|
|
2014-11-26 04:39:23 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2008-12-02 10:44:39 +00:00
|
|
|
#endif
|