2014-03-15 16:59:03 +00:00
|
|
|
// SONIC ROBO BLAST 2
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
|
|
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
2021-05-07 15:45:56 +00:00
|
|
|
// Copyright (C) 1999-2021 by Sonic Team Junior.
|
2014-03-15 16:59:03 +00:00
|
|
|
//
|
|
|
|
// This program is free software distributed under the
|
|
|
|
// terms of the GNU General Public License, version 2.
|
|
|
|
// See the 'LICENSE' file for more details.
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
/// \file r_data.h
|
|
|
|
/// \brief Refresh module, data I/O, caching, retrieval of graphics by name
|
|
|
|
|
|
|
|
#ifndef __R_DATA__
|
|
|
|
#define __R_DATA__
|
|
|
|
|
|
|
|
#include "r_defs.h"
|
|
|
|
#include "r_state.h"
|
2019-05-27 02:37:23 +00:00
|
|
|
#include "p_setup.h" // levelflats
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
2020-01-07 15:35:10 +00:00
|
|
|
// Store lists of lumps for F_START/F_END etc.
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
UINT16 wadfile;
|
|
|
|
UINT16 firstlump;
|
|
|
|
size_t numlumps;
|
|
|
|
} lumplist_t;
|
|
|
|
|
2017-03-04 19:59:43 +00:00
|
|
|
// Possible alpha types for a patch.
|
2019-09-08 16:21:00 +00:00
|
|
|
enum patchalphastyle {AST_COPY, AST_TRANSLUCENT, AST_ADD, AST_SUBTRACT, AST_REVERSESUBTRACT, AST_MODULATE, AST_OVERLAY};
|
|
|
|
|
2019-09-18 01:29:53 +00:00
|
|
|
UINT32 ASTBlendPixel(RGBA_t background, RGBA_t foreground, int style, UINT8 alpha);
|
2020-05-16 16:51:10 +00:00
|
|
|
UINT32 ASTBlendTexturePixel(RGBA_t background, RGBA_t foreground, int style, UINT8 alpha);
|
|
|
|
UINT8 ASTBlendPaletteIndexes(UINT8 background, UINT8 foreground, int style, UINT8 alpha);
|
|
|
|
|
|
|
|
extern INT32 ASTTextureBlendingThreshold[2];
|
2019-09-08 16:21:00 +00:00
|
|
|
|
2014-03-15 16:59:03 +00:00
|
|
|
extern INT16 color8to16[256]; // remap color index to highcolor
|
|
|
|
extern INT16 *hicolormaps; // remap high colors to high colors..
|
|
|
|
|
|
|
|
extern CV_PossibleValue_t Color_cons_t[];
|
|
|
|
|
|
|
|
// I/O, setting up the stuff.
|
|
|
|
void R_InitData(void);
|
|
|
|
void R_PrecacheLevel(void);
|
|
|
|
|
2019-08-18 17:16:48 +00:00
|
|
|
extern size_t flatmemory, spritememory, texturememory;
|
|
|
|
|
2018-09-11 00:36:34 +00:00
|
|
|
// Extra Colormap lumps (C_START/C_END) are not used anywhere
|
|
|
|
// Uncomment to enable
|
|
|
|
//#define EXTRACOLORMAPLUMPS
|
|
|
|
|
2018-09-11 02:35:03 +00:00
|
|
|
// Uncomment to make extra_colormaps order Newest -> Oldest
|
|
|
|
//#define COLORMAPREVERSELIST
|
|
|
|
|
2014-03-15 16:59:03 +00:00
|
|
|
void R_ReInitColormaps(UINT16 num);
|
|
|
|
void R_ClearColormaps(void);
|
2018-09-11 17:46:34 +00:00
|
|
|
extracolormap_t *R_CreateDefaultColormap(boolean lighttable);
|
2018-09-11 19:01:05 +00:00
|
|
|
extracolormap_t *R_GetDefaultColormap(void);
|
2018-09-11 19:20:30 +00:00
|
|
|
extracolormap_t *R_CopyColormap(extracolormap_t *extra_colormap, boolean lighttable);
|
2018-09-11 00:36:34 +00:00
|
|
|
void R_AddColormapToList(extracolormap_t *extra_colormap);
|
2018-09-11 21:06:44 +00:00
|
|
|
|
2018-09-11 19:50:12 +00:00
|
|
|
#ifdef EXTRACOLORMAPLUMPS
|
2018-09-11 21:06:44 +00:00
|
|
|
boolean R_CheckDefaultColormapByValues(boolean checkrgba, boolean checkfadergba, boolean checkparams,
|
2020-02-16 19:19:24 +00:00
|
|
|
INT32 rgba, INT32 fadergba, UINT8 fadestart, UINT8 fadeend, UINT8 flags, lumpnum_t lump);
|
|
|
|
extracolormap_t *R_GetColormapFromListByValues(INT32 rgba, INT32 fadergba, UINT8 fadestart, UINT8 fadeend, UINT8 flags, lumpnum_t lump);
|
2018-09-11 19:50:12 +00:00
|
|
|
#else
|
2018-09-11 21:06:44 +00:00
|
|
|
boolean R_CheckDefaultColormapByValues(boolean checkrgba, boolean checkfadergba, boolean checkparams,
|
2020-02-16 19:19:24 +00:00
|
|
|
INT32 rgba, INT32 fadergba, UINT8 fadestart, UINT8 fadeend, UINT8 flags);
|
|
|
|
extracolormap_t *R_GetColormapFromListByValues(INT32 rgba, INT32 fadergba, UINT8 fadestart, UINT8 fadeend, UINT8 flags);
|
2018-09-11 19:50:12 +00:00
|
|
|
#endif
|
2018-09-11 21:06:44 +00:00
|
|
|
boolean R_CheckDefaultColormap(extracolormap_t *extra_colormap, boolean checkrgba, boolean checkfadergba, boolean checkparams);
|
2018-09-12 02:34:29 +00:00
|
|
|
boolean R_CheckEqualColormaps(extracolormap_t *exc_a, extracolormap_t *exc_b, boolean checkrgba, boolean checkfadergba, boolean checkparams);
|
2018-09-11 19:50:12 +00:00
|
|
|
extracolormap_t *R_GetColormapFromList(extracolormap_t *extra_colormap);
|
2018-09-11 21:06:44 +00:00
|
|
|
|
2020-04-18 15:15:25 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
TMCF_RELATIVE = 1,
|
|
|
|
TMCF_SUBLIGHTR = 1<<1,
|
|
|
|
TMCF_SUBLIGHTG = 1<<2,
|
|
|
|
TMCF_SUBLIGHTB = 1<<3,
|
|
|
|
TMCF_SUBLIGHTA = 1<<4,
|
|
|
|
TMCF_SUBFADER = 1<<5,
|
|
|
|
TMCF_SUBFADEG = 1<<6,
|
|
|
|
TMCF_SUBFADEB = 1<<7,
|
|
|
|
TMCF_SUBFADEA = 1<<8,
|
|
|
|
TMCF_SUBFADESTART = 1<<9,
|
|
|
|
TMCF_SUBFADEEND = 1<<10,
|
|
|
|
TMCF_IGNOREFLAGS = 1<<11,
|
|
|
|
TMCF_FROMBLACK = 1<<12,
|
|
|
|
TMCF_OVERRIDE = 1<<13,
|
|
|
|
} textmapcolormapflags_t;
|
|
|
|
|
2018-09-10 19:59:31 +00:00
|
|
|
lighttable_t *R_CreateLightTable(extracolormap_t *extra_colormap);
|
2020-03-15 08:55:57 +00:00
|
|
|
extracolormap_t * R_CreateColormapFromLinedef(char *p1, char *p2, char *p3);
|
|
|
|
extracolormap_t* R_CreateColormap(INT32 rgba, INT32 fadergba, UINT8 fadestart, UINT8 fadeend, UINT8 flags);
|
2018-09-12 01:02:58 +00:00
|
|
|
extracolormap_t *R_AddColormaps(extracolormap_t *exc_augend, extracolormap_t *exc_addend,
|
|
|
|
boolean subR, boolean subG, boolean subB, boolean subA,
|
|
|
|
boolean subFadeR, boolean subFadeG, boolean subFadeB, boolean subFadeA,
|
2020-02-16 19:19:24 +00:00
|
|
|
boolean subFadeStart, boolean subFadeEnd, boolean ignoreFlags,
|
2018-09-12 01:02:58 +00:00
|
|
|
boolean lighttable);
|
2018-09-11 00:36:34 +00:00
|
|
|
#ifdef EXTRACOLORMAPLUMPS
|
|
|
|
extracolormap_t *R_ColormapForName(char *name);
|
|
|
|
const char *R_NameForColormap(extracolormap_t *extra_colormap);
|
|
|
|
#endif
|
2014-03-15 16:59:03 +00:00
|
|
|
|
2018-09-11 21:06:44 +00:00
|
|
|
#define R_GetRgbaR(rgba) (rgba & 0xFF)
|
|
|
|
#define R_GetRgbaG(rgba) ((rgba >> 8) & 0xFF)
|
|
|
|
#define R_GetRgbaB(rgba) ((rgba >> 16) & 0xFF)
|
|
|
|
#define R_GetRgbaA(rgba) ((rgba >> 24) & 0xFF)
|
2018-09-11 21:30:43 +00:00
|
|
|
#define R_GetRgbaRGB(rgba) (rgba & 0xFFFFFF)
|
|
|
|
#define R_PutRgbaR(r) (r)
|
|
|
|
#define R_PutRgbaG(g) (g << 8)
|
|
|
|
#define R_PutRgbaB(b) (b << 16)
|
|
|
|
#define R_PutRgbaA(a) (a << 24)
|
|
|
|
#define R_PutRgbaRGB(r, g, b) (R_PutRgbaR(r) + R_PutRgbaG(g) + R_PutRgbaB(b))
|
|
|
|
#define R_PutRgbaRGBA(r, g, b, a) (R_PutRgbaRGB(r, g, b) + R_PutRgbaA(a))
|
2018-09-11 21:06:44 +00:00
|
|
|
|
2020-01-27 16:55:13 +00:00
|
|
|
UINT8 NearestPaletteColor(UINT8 r, UINT8 g, UINT8 b, RGBA_t *palette);
|
|
|
|
#define NearestColor(r, g, b) NearestPaletteColor(r, g, b, NULL)
|
2019-11-10 03:04:11 +00:00
|
|
|
|
2014-03-15 16:59:03 +00:00
|
|
|
#endif
|