diff options
Diffstat (limited to 'src/r_patch.h')
-rw-r--r-- | src/r_patch.h | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/src/r_patch.h b/src/r_patch.h new file mode 100644 index 0000000..b0d1387 --- /dev/null +++ b/src/r_patch.h | |||
@@ -0,0 +1,111 @@ | |||
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 | typedef struct { | ||
46 | int topdelta; | ||
47 | int length; | ||
48 | edgeslope_t slope; | ||
49 | } rpost_t; | ||
50 | |||
51 | typedef struct { | ||
52 | int numPosts; | ||
53 | rpost_t *posts; | ||
54 | unsigned char *pixels; | ||
55 | } rcolumn_t; | ||
56 | |||
57 | typedef struct { | ||
58 | int width; | ||
59 | int height; | ||
60 | unsigned widthmask; | ||
61 | |||
62 | unsigned char isNotTileable; | ||
63 | |||
64 | int leftoffset; | ||
65 | int topoffset; | ||
66 | |||
67 | // this is the single malloc'ed/free'd array | ||
68 | // for this patch | ||
69 | unsigned char *data; | ||
70 | |||
71 | // these are pointers into the data array | ||
72 | unsigned char *pixels; | ||
73 | rcolumn_t *columns; | ||
74 | rpost_t *posts; | ||
75 | |||
76 | #ifdef TIMEDIAG | ||
77 | int locktic; | ||
78 | #endif | ||
79 | unsigned int locks; | ||
80 | } rpatch_t; | ||
81 | |||
82 | |||
83 | const rpatch_t *R_CachePatchNum(int id); | ||
84 | void R_UnlockPatchNum(int id); | ||
85 | #define R_CachePatchName(name) R_CachePatchNum(W_GetNumForName(name)) | ||
86 | #define R_UnlockPatchName(name) R_UnlockPatchNum(W_GetNumForName(name)) | ||
87 | |||
88 | const rpatch_t *R_CacheTextureCompositePatchNum(int id); | ||
89 | void R_UnlockTextureCompositePatchNum(int id); | ||
90 | |||
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_FlushAllPatches(); | ||
110 | |||
111 | #endif | ||