| 1 |
/* Emacs style mode select -*- C -*- |
| 2 |
*----------------------------------------------------------------------------- |
| 3 |
* |
| 4 |
* |
| 5 |
* PrBoom: a Doom port merged with LxDoom and LSDLDoom |
| 6 |
* based on BOOM, a modified and improved DOOM engine |
| 7 |
* Copyright (C) 1999 by |
| 8 |
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman |
| 9 |
* Copyright (C) 1999-2000 by |
| 10 |
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze |
| 11 |
* Copyright 2005, 2006 by |
| 12 |
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko |
| 13 |
* |
| 14 |
* This program is free software; you can redistribute it and/or |
| 15 |
* modify it under the terms of the GNU General Public License |
| 16 |
* as published by the Free Software Foundation; either version 2 |
| 17 |
* of the License, or (at your option) any later version. |
| 18 |
* |
| 19 |
* This program is distributed in the hope that it will be useful, |
| 20 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 21 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 22 |
* GNU General Public License for more details. |
| 23 |
* |
| 24 |
* You should have received a copy of the GNU General Public License |
| 25 |
* along with this program; if not, write to the Free Software |
| 26 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
| 27 |
* 02111-1307, USA. |
| 28 |
* |
| 29 |
*-----------------------------------------------------------------------------*/ |
| 30 |
|
| 31 |
|
| 32 |
#ifndef R_PATCH_H |
| 33 |
#define R_PATCH_H |
| 34 |
|
| 35 |
// Used to specify the sloping of the top and bottom of a column post |
| 36 |
typedef enum { |
| 37 |
RDRAW_EDGESLOPE_TOP_UP = (1<<0), |
| 38 |
RDRAW_EDGESLOPE_TOP_DOWN = (1<<1), |
| 39 |
RDRAW_EDGESLOPE_BOT_UP = (1<<2), |
| 40 |
RDRAW_EDGESLOPE_BOT_DOWN = (1<<3), |
| 41 |
RDRAW_EDGESLOPE_TOP_MASK = 0x3, |
| 42 |
RDRAW_EDGESLOPE_BOT_MASK = 0xc, |
| 43 |
} edgeslope_t; |
| 44 |
|
| 45 |
//e6y |
| 46 |
typedef enum { |
| 47 |
PATCH_ISNOTTILEABLE = 0x00000001, |
| 48 |
PATCH_REPEAT = 0x00000002, |
| 49 |
PATCH_HASHOLES = 0x00000004, |
| 50 |
} rpatch_flag_t; |
| 51 |
|
| 52 |
typedef struct { |
| 53 |
int topdelta; |
| 54 |
int length; |
| 55 |
edgeslope_t slope; |
| 56 |
} rpost_t; |
| 57 |
|
| 58 |
typedef struct { |
| 59 |
int numPosts; |
| 60 |
rpost_t *posts; |
| 61 |
unsigned char *pixels; |
| 62 |
} rcolumn_t; |
| 63 |
|
| 64 |
typedef struct { |
| 65 |
int width; |
| 66 |
int height; |
| 67 |
unsigned widthmask; |
| 68 |
|
| 69 |
int leftoffset; |
| 70 |
int topoffset; |
| 71 |
|
| 72 |
// this is the single malloc'ed/free'd array |
| 73 |
// for this patch |
| 74 |
unsigned char *data; |
| 75 |
|
| 76 |
// these are pointers into the data array |
| 77 |
unsigned char *pixels; |
| 78 |
rcolumn_t *columns; |
| 79 |
rpost_t *posts; |
| 80 |
|
| 81 |
unsigned int flags;//e6y |
| 82 |
} rpatch_t; |
| 83 |
|
| 84 |
|
| 85 |
const rpatch_t *R_PatchByNum(int id); |
| 86 |
#define R_PatchByName(name) R_PatchByNum(W_GetNumForName(name)) |
| 87 |
|
| 88 |
const rpatch_t *R_TextureCompositePatchByNum(int id); |
| 89 |
|
| 90 |
dboolean R_IsPatchLump(int lumpnum); |
| 91 |
|
| 92 |
// Size query funcs |
| 93 |
int R_NumPatchWidth(int lump) ; |
| 94 |
int R_NumPatchHeight(int lump); |
| 95 |
#define R_NamePatchWidth(name) R_NumPatchWidth(W_GetNumForName(name)) |
| 96 |
#define R_NamePatchHeight(name) R_NumPatchHeight(W_GetNumForName(name)) |
| 97 |
|
| 98 |
|
| 99 |
const rcolumn_t *R_GetPatchColumnWrapped(const rpatch_t *patch, int columnIndex); |
| 100 |
const rcolumn_t *R_GetPatchColumnClamped(const rpatch_t *patch, int columnIndex); |
| 101 |
|
| 102 |
|
| 103 |
// returns R_GetPatchColumnWrapped for square, non-holed textures |
| 104 |
// and R_GetPatchColumnClamped otherwise |
| 105 |
const rcolumn_t *R_GetPatchColumn(const rpatch_t *patch, int columnIndex); |
| 106 |
|
| 107 |
|
| 108 |
void R_InitPatches(); |
| 109 |
void R_UpdatePlayPal(); |
| 110 |
void R_FlushAllPatches(); |
| 111 |
|
| 112 |
extern int playpal_darkest; |
| 113 |
extern int playpal_lightest; |
| 114 |
|
| 115 |
#endif |