2020-01-07 15:35:10 +00:00
|
|
|
// SONIC ROBO BLAST 2
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
|
|
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
2023-03-31 12:53:31 +00:00
|
|
|
// Copyright (C) 1999-2023 by Sonic Team Junior.
|
2020-01-07 15:35:10 +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_textures.h
|
|
|
|
/// \brief Texture generation.
|
|
|
|
|
|
|
|
#ifndef __R_TEXTURES__
|
|
|
|
#define __R_TEXTURES__
|
|
|
|
|
|
|
|
#include "r_defs.h"
|
|
|
|
#include "r_state.h"
|
|
|
|
#include "p_setup.h" // levelflats
|
|
|
|
#include "r_data.h"
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// 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;
|
|
|
|
UINT16 wad, lump;
|
|
|
|
UINT8 flip; // 1 = flipx, 2 = flipy, 3 = both
|
|
|
|
UINT8 alpha; // Translucency value
|
|
|
|
enum patchalphastyle style;
|
|
|
|
} texpatch_t;
|
|
|
|
|
|
|
|
// texture type
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
TEXTURETYPE_UNKNOWN,
|
|
|
|
TEXTURETYPE_SINGLEPATCH,
|
|
|
|
TEXTURETYPE_COMPOSITE,
|
2023-08-01 20:19:58 +00:00
|
|
|
TEXTURETYPE_FLAT
|
2020-01-07 15:35:10 +00:00
|
|
|
};
|
|
|
|
|
2020-01-07 19:51:02 +00:00
|
|
|
// A texture_t describes a rectangular texture,
|
|
|
|
// which is composed of one or more texpatch_t structures
|
2020-01-07 15:35:10 +00:00
|
|
|
// that arrange graphic patches.
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
// Keep name for switch changing, etc.
|
|
|
|
char name[8];
|
2021-12-17 06:10:36 +00:00
|
|
|
UINT32 hash;
|
2024-01-15 05:05:25 +00:00
|
|
|
UINT8 type; // TEXTURETYPE_*
|
2020-01-07 15:35:10 +00:00
|
|
|
INT16 width, height;
|
|
|
|
UINT8 flip; // 1 = flipx, 2 = flipy, 3 = both
|
2020-01-07 19:51:02 +00:00
|
|
|
void *flat; // The texture, as a flat.
|
2020-01-07 15:35:10 +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;
|
|
|
|
|
|
|
|
extern INT32 *texturewidth;
|
|
|
|
extern fixed_t *textureheight; // needed for texture pegging
|
|
|
|
|
2023-07-30 23:56:28 +00:00
|
|
|
extern column_t **texturecolumns; // columns for each texture
|
2020-01-07 15:35:10 +00:00
|
|
|
extern UINT8 **texturecache; // graphics data for each generated full-size texture
|
|
|
|
|
|
|
|
// Load TEXTURES definitions, create lookup tables
|
|
|
|
void R_LoadTextures(void);
|
2021-12-17 02:34:51 +00:00
|
|
|
void R_LoadTexturesPwad(UINT16 wadnum);
|
2020-01-07 15:35:10 +00:00
|
|
|
void R_FlushTextureCache(void);
|
|
|
|
|
2020-01-07 15:43:27 +00:00
|
|
|
// Texture generation
|
2020-01-07 15:35:10 +00:00
|
|
|
UINT8 *R_GenerateTexture(size_t texnum);
|
2023-08-01 20:19:58 +00:00
|
|
|
UINT8 *R_GetFlatForTexture(size_t texnum);
|
2020-01-07 15:35:10 +00:00
|
|
|
INT32 R_GetTextureNum(INT32 texnum);
|
|
|
|
void R_CheckTextureCache(INT32 tex);
|
2020-01-07 15:43:27 +00:00
|
|
|
void R_ClearTextureNumCache(boolean btell);
|
2020-01-07 15:35:10 +00:00
|
|
|
|
2020-01-07 15:43:27 +00:00
|
|
|
// Retrieve texture data.
|
2023-07-30 23:56:28 +00:00
|
|
|
column_t *R_GetColumn(fixed_t tex, INT32 col);
|
2023-08-01 20:19:58 +00:00
|
|
|
void *R_GetFlat(levelflat_t *levelflat);
|
|
|
|
|
|
|
|
INT32 R_GetTextureNumForFlat(levelflat_t *levelflat);
|
2020-01-07 15:35:10 +00:00
|
|
|
|
2020-01-07 15:46:46 +00:00
|
|
|
boolean R_CheckPowersOfTwo(void);
|
2022-11-16 01:40:54 +00:00
|
|
|
boolean R_CheckSolidColorFlat(void);
|
|
|
|
|
|
|
|
UINT16 R_GetFlatSize(size_t length);
|
|
|
|
UINT8 R_GetFlatBits(INT32 size);
|
|
|
|
void R_SetFlatVars(size_t length);
|
2020-01-07 15:46:46 +00:00
|
|
|
|
2020-01-07 15:43:27 +00:00
|
|
|
// Returns the texture number for the texture name.
|
2020-01-07 15:35:10 +00:00
|
|
|
INT32 R_TextureNumForName(const char *name);
|
|
|
|
INT32 R_CheckTextureNumForName(const char *name);
|
2023-08-01 20:19:58 +00:00
|
|
|
INT32 R_CheckFlatNumForName(const char *name);
|
2020-01-07 15:35:10 +00:00
|
|
|
|
2022-11-20 20:25:53 +00:00
|
|
|
// Returns the texture name for the texture number (in case you ever needed it)
|
2022-11-20 21:06:43 +00:00
|
|
|
const char *R_CheckTextureNameForNum(INT32 num);
|
|
|
|
const char *R_TextureNameForNum(INT32 num);
|
2022-11-20 20:25:53 +00:00
|
|
|
|
2020-01-07 15:35:10 +00:00
|
|
|
extern INT32 numtextures;
|
|
|
|
|
|
|
|
#endif
|