diff options
Diffstat (limited to 'apps/plugins/doom/v_video.h')
-rw-r--r-- | apps/plugins/doom/v_video.h | 185 |
1 files changed, 185 insertions, 0 deletions
diff --git a/apps/plugins/doom/v_video.h b/apps/plugins/doom/v_video.h new file mode 100644 index 0000000000..c9926e8997 --- /dev/null +++ b/apps/plugins/doom/v_video.h | |||
@@ -0,0 +1,185 @@ | |||
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 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This program is distributed in the hope that it will be useful, | ||
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
20 | * GNU General Public License for more details. | ||
21 | * | ||
22 | * You should have received a copy of the GNU General Public License | ||
23 | * along with this program; if not, write to the Free Software | ||
24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | ||
25 | * 02111-1307, USA. | ||
26 | * | ||
27 | * DESCRIPTION: | ||
28 | * Gamma correction LUT. | ||
29 | * Color range translation support | ||
30 | * Functions to draw patches (by post) directly to screen. | ||
31 | * Functions to blit a block to the screen. | ||
32 | * | ||
33 | *-----------------------------------------------------------------------------*/ | ||
34 | |||
35 | #ifndef __V_VIDEO__ | ||
36 | #define __V_VIDEO__ | ||
37 | |||
38 | #include "doomtype.h" | ||
39 | #include "doomdef.h" | ||
40 | // Needed because we are refering to patches. | ||
41 | #include "r_data.h" | ||
42 | |||
43 | // | ||
44 | // VIDEO | ||
45 | // | ||
46 | |||
47 | #define CENTERY (SCREENHEIGHT/2) | ||
48 | |||
49 | // Screen 0 is the screen updated by I_Update screen. | ||
50 | // Screen 1 is an extra buffer. | ||
51 | |||
52 | // array of pointers to color translation tables | ||
53 | extern const byte *colrngs[]; | ||
54 | |||
55 | // symbolic indices into color translation table pointer array | ||
56 | typedef enum | ||
57 | { | ||
58 | CR_BRICK, //0 | ||
59 | CR_TAN, //1 | ||
60 | CR_GRAY, //2 | ||
61 | CR_GREEN, //3 | ||
62 | CR_BROWN, //4 | ||
63 | CR_GOLD, //5 | ||
64 | CR_RED, //6 | ||
65 | CR_BLUE, //7 | ||
66 | CR_ORANGE, //8 | ||
67 | CR_YELLOW, //9 | ||
68 | CR_BLUE2, //10 // proff | ||
69 | CR_LIMIT //11 //jff 2/27/98 added for range check | ||
70 | } crange_idx_e; | ||
71 | //jff 1/16/98 end palette color range additions | ||
72 | |||
73 | #define CR_DEFAULT CR_RED /* default value for out of range colors */ | ||
74 | |||
75 | extern byte *screens[6]; | ||
76 | extern int dirtybox[4]; | ||
77 | extern const byte gammatable[5][256]; | ||
78 | extern int usegamma; | ||
79 | |||
80 | //jff 4/24/98 loads color translation lumps | ||
81 | void V_InitColorTranslation(void); | ||
82 | |||
83 | // Allocates buffer screens, call before R_Init. | ||
84 | void V_Init (void); | ||
85 | |||
86 | enum patch_translation_e { | ||
87 | VPT_NONE = 0, // Normal | ||
88 | VPT_FLIP = 1, // Flip image horizontally | ||
89 | VPT_TRANS = 2, // Translate image via a translation table | ||
90 | VPT_STRETCH = 4, // Stretch to compensate for high-res | ||
91 | }; | ||
92 | |||
93 | #ifndef GL_DOOM | ||
94 | void V_CopyRect(int srcx, int srcy, int srcscrn, int width, int height, | ||
95 | int destx, int desty, int destscrn, | ||
96 | enum patch_translation_e flags); | ||
97 | #else | ||
98 | #define V_CopyRect(sx,sy,ss,w,h,dx,dy,ds,f) | ||
99 | #endif /* GL_DOOM */ | ||
100 | |||
101 | #ifdef GL_DOOM | ||
102 | #define V_FillRect(s,x,y,w,h,c) gld_FillBlock(x,y,w,h,c) | ||
103 | #else | ||
104 | void V_FillRect(int scrn, int x, int y, int width, int height, byte colour); | ||
105 | #endif | ||
106 | |||
107 | // CPhipps - patch drawing | ||
108 | // Consolidated into the 3 really useful functions: | ||
109 | // V_DrawMemPatch - Draws the given patch_t | ||
110 | #ifdef GL_DOOM | ||
111 | #define V_DrawMemPatch(x,y,s,p,t,f) gld_DrawPatchFromMem(x,y,p,t,f) | ||
112 | #else | ||
113 | void V_DrawMemPatch(int x, int y, int scrn, const patch_t *patch, | ||
114 | int cm, enum patch_translation_e flags); | ||
115 | #endif | ||
116 | // V_DrawNumPatch - Draws the patch from lump num | ||
117 | #ifdef GL_DOOM | ||
118 | #define V_DrawNumPatch(x,y,s,l,t,f) gld_DrawNumPatch(x,y,l,t,f) | ||
119 | #else | ||
120 | void V_DrawNumPatch(int x, int y, int scrn, int lump, | ||
121 | int cm, enum patch_translation_e flags); | ||
122 | #endif | ||
123 | // V_DrawNamePatch - Draws the patch from lump "name" | ||
124 | #ifdef GL_DOOM | ||
125 | #define V_DrawNamePatch(x,y,s,n,t,f) gld_DrawNumPatch(x,y,W_GetNumForName(n),t,f) | ||
126 | #else | ||
127 | #define V_DrawNamePatch(x,y,s,n,t,f) V_DrawNumPatch(x,y,s,W_GetNumForName(n),t,f) | ||
128 | #endif | ||
129 | |||
130 | /* cph - | ||
131 | * Functions to return width & height of a patch. | ||
132 | * Doesn't really belong here, but is often used in conjunction with | ||
133 | * this code. | ||
134 | */ | ||
135 | int V_NamePatchWidth(const char* name); | ||
136 | int V_NamePatchHeight(const char* name); | ||
137 | |||
138 | // Draw a linear block of pixels into the view buffer. | ||
139 | |||
140 | // CPhipps - added const's, patch translation flags for stretching | ||
141 | #ifndef GL_DOOM | ||
142 | void V_DrawBlock(int x, int y, int scrn, int width, int height, | ||
143 | const byte *src, enum patch_translation_e flags); | ||
144 | #endif | ||
145 | |||
146 | /* cphipps 10/99: function to tile a flat over the screen */ | ||
147 | #ifdef GL_DOOM | ||
148 | #define V_DrawBackground(n,s) gld_DrawBackground(n) | ||
149 | #else | ||
150 | void V_DrawBackground(const char* flatname, int scrn); | ||
151 | #endif | ||
152 | |||
153 | // Reads a linear block of pixels into the view buffer. | ||
154 | |||
155 | #ifndef GL_DOOM | ||
156 | void V_GetBlock(int x, int y, int scrn, int width, int height, byte *dest); | ||
157 | |||
158 | void V_MarkRect(int x, int y, int width,int height); | ||
159 | |||
160 | // CPhipps - function to convert a patch_t into a simple block bitmap | ||
161 | // Returns pointer to the malloc()'ed bitmap, and its width and height | ||
162 | byte *V_PatchToBlock(const char* name, int cm, | ||
163 | enum patch_translation_e flags, | ||
164 | unsigned short* width, unsigned short* height); | ||
165 | #else | ||
166 | #define V_MarkRect(x,y,w,h) | ||
167 | #define V_PatchToBlock(n,cm,f,w,h) NULL | ||
168 | #endif | ||
169 | |||
170 | // CPhipps - function to set the palette to palette number pal. | ||
171 | void V_SetPalette(int pal); | ||
172 | |||
173 | // CPhipps - function to plot a pixel | ||
174 | |||
175 | #ifndef GL_DOOM | ||
176 | #define V_PlotPixel(s,x,y,c) screens[s][x+SCREENWIDTH*y]=c | ||
177 | #endif | ||
178 | |||
179 | #define V_AllocScreen(scrn) screens[scrn] = malloc(SCREENWIDTH*SCREENHEIGHT) | ||
180 | #define V_FreeScreen(scrn) free(screens[scrn]); screens[scrn] = NULL | ||
181 | |||
182 | #ifdef GL_DOOM | ||
183 | #include "gl_struct.h" | ||
184 | #endif | ||
185 | #endif | ||