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.
|
2016-05-18 00:42:11 +00:00
|
|
|
// Copyright (C) 1999-2016 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"
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
2017-03-04 19:59:43 +00:00
|
|
|
// Possible alpha types for a patch.
|
|
|
|
enum patchalphastyle {AST_COPY, AST_TRANSLUCENT}; // , AST_ADD, AST_SUBTRACT, AST_REVERSESUBTRACT, AST_MODULATE, AST_OVERLAY};
|
|
|
|
|
2014-03-15 16:59:03 +00:00
|
|
|
// moved here for r_sky.c (texpatch_t is used)
|
|
|
|
|
|
|
|
// A single patch from a texture definition,
|
|
|
|
// basically a rectangular area within
|
|
|
|
// the texture rectangle.
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
// Block origin (always UL), which has already accounted for the internal origin of the patch.
|
|
|
|
INT16 originx, originy;
|
2016-07-24 03:02:10 +00:00
|
|
|
UINT16 wad, lump;
|
2016-10-22 22:19:24 +00:00
|
|
|
UINT8 flip; // 1 = flipx, 2 = flipy, 3 = both
|
2017-03-04 19:59:43 +00:00
|
|
|
UINT8 alpha; // Translucency value
|
2017-03-12 19:26:45 +00:00
|
|
|
enum patchalphastyle style;
|
2014-03-15 16:59:03 +00:00
|
|
|
} texpatch_t;
|
|
|
|
|
|
|
|
// A maptexturedef_t describes a rectangular texture,
|
|
|
|
// which is composed of one or more mappatch_t structures
|
|
|
|
// that arrange graphic patches.
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
// Keep name for switch changing, etc.
|
|
|
|
char name[8];
|
|
|
|
INT16 width, height;
|
|
|
|
boolean holes;
|
2016-11-28 22:21:54 +00:00
|
|
|
UINT8 flip; // 1 = flipx, 2 = flipy, 3 = both
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
// All the patches[patchcount] are drawn back to front into the cached texture.
|
|
|
|
INT16 patchcount;
|
|
|
|
texpatch_t patches[0];
|
|
|
|
} texture_t;
|
|
|
|
|
|
|
|
// all loaded and prepared textures from the start of the game
|
|
|
|
extern texture_t **textures;
|
|
|
|
|
|
|
|
// texture width is a power of 2, so it can easily repeat along sidedefs using a simple mask
|
|
|
|
extern INT32 *texturewidthmask;
|
|
|
|
|
|
|
|
extern fixed_t *textureheight; // needed for texture pegging
|
|
|
|
|
|
|
|
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[];
|
|
|
|
|
2017-08-07 19:33:24 +00:00
|
|
|
// Load TEXTURES definitions, create lookup tables
|
2014-03-15 16:59:03 +00:00
|
|
|
void R_LoadTextures(void);
|
|
|
|
void R_FlushTextureCache(void);
|
|
|
|
|
2016-12-16 21:38:53 +00:00
|
|
|
INT32 R_GetTextureNum(INT32 texnum);
|
2016-12-17 19:59:54 +00:00
|
|
|
void R_CheckTextureCache(INT32 tex);
|
2016-12-16 21:38:53 +00:00
|
|
|
|
2014-03-15 16:59:03 +00:00
|
|
|
// Retrieve column data for span blitting.
|
|
|
|
UINT8 *R_GetColumn(fixed_t tex, INT32 col);
|
|
|
|
|
|
|
|
UINT8 *R_GetFlat(lumpnum_t flatnum);
|
|
|
|
|
|
|
|
// I/O, setting up the stuff.
|
|
|
|
void R_InitData(void);
|
|
|
|
void R_PrecacheLevel(void);
|
|
|
|
|
|
|
|
// Retrieval.
|
|
|
|
// Floor/ceiling opaque texture tiles,
|
|
|
|
// lookup by name. For animation?
|
|
|
|
lumpnum_t R_GetFlatNumForName(const char *name);
|
|
|
|
#define R_FlatNumForName(x) R_GetFlatNumForName(x)
|
|
|
|
|
|
|
|
// Called by P_Ticker for switches and animations,
|
|
|
|
// returns the texture number for the texture name.
|
|
|
|
void R_ClearTextureNumCache(boolean btell);
|
|
|
|
INT32 R_TextureNumForName(const char *name);
|
|
|
|
INT32 R_CheckTextureNumForName(const char *name);
|
|
|
|
|
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,
|
|
|
|
INT32 rgba, INT32 fadergba, UINT8 fadestart, UINT8 fadeend, boolean fog, lumpnum_t lump);
|
2018-09-11 19:50:12 +00:00
|
|
|
extracolormap_t *R_GetColormapFromListByValues(INT32 rgba, INT32 fadergba, UINT8 fadestart, UINT8 fadeend, boolean fog, lumpnum_t lump);
|
|
|
|
#else
|
2018-09-11 21:06:44 +00:00
|
|
|
boolean R_CheckDefaultColormapByValues(boolean checkrgba, boolean checkfadergba, boolean checkparams,
|
|
|
|
INT32 rgba, INT32 fadergba, UINT8 fadestart, UINT8 fadeend, boolean fog);
|
2018-09-11 19:50:12 +00:00
|
|
|
extracolormap_t *R_GetColormapFromListByValues(INT32 rgba, INT32 fadergba, UINT8 fadestart, UINT8 fadeend, boolean fog);
|
|
|
|
#endif
|
2018-09-11 21:06:44 +00:00
|
|
|
boolean R_CheckDefaultColormap(extracolormap_t *extra_colormap, 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
|
|
|
|
2018-09-10 19:59:31 +00:00
|
|
|
lighttable_t *R_CreateLightTable(extracolormap_t *extra_colormap);
|
|
|
|
extracolormap_t *R_CreateColormap(char *p1, char *p2, char *p3);
|
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)
|
|
|
|
|
2014-03-15 16:59:03 +00:00
|
|
|
extern INT32 numtextures;
|
|
|
|
|
|
|
|
#endif
|