Prepare new maemo release
[maemo-rb.git] / apps / plugins / doom / v_video.h
blobcb23895068a07ecd9552bcd5a8553ae2725422fc
1 /* Emacs style mode select -*- C++ -*-
2 *-----------------------------------------------------------------------------
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
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.
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.
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.
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.
33 *-----------------------------------------------------------------------------*/
35 #ifndef __V_VIDEO__
36 #define __V_VIDEO__
38 #include "doomtype.h"
39 #include "doomdef.h"
40 // Needed because we are refering to patches.
41 #include "r_data.h"
44 // VIDEO
47 #define CENTERY (SCREENHEIGHT/2)
49 // Screen 0 is the screen updated by I_Update screen.
50 // Screen 1 is an extra buffer.
52 // array of pointers to color translation tables
53 extern const byte *colrngs[];
55 // symbolic indices into color translation table pointer array
56 enum
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
71 typedef unsigned crange_idx_e;
72 //jff 1/16/98 end palette color range additions
74 #define CR_DEFAULT CR_RED /* default value for out of range colors */
76 extern byte *d_screens[6];
77 extern int dirtybox[4];
78 extern const byte gammatable[5][256];
79 extern int usegamma;
81 //jff 4/24/98 loads color translation lumps
82 void V_InitColorTranslation(void);
84 // Allocates buffer screens, call before R_Init.
85 void V_Init (void);
87 enum {
88 VPT_NONE = 0, // Normal
89 VPT_FLIP = 1, // Flip image horizontally
90 VPT_TRANS = 2, // Translate image via a translation table
91 VPT_STRETCH = 4, // Stretch to compensate for high-res
93 typedef unsigned patch_translation_e;
95 #ifndef GL_DOOM
96 void V_CopyRect(int srcx, int srcy, int srcscrn, int width, int height,
97 int destx, int desty, int destscrn,
98 patch_translation_e flags);
99 #else
100 #define V_CopyRect(sx,sy,ss,w,h,dx,dy,ds,f)
101 #endif /* GL_DOOM */
103 #ifdef GL_DOOM
104 #define V_FillRect(s,x,y,w,h,c) gld_FillBlock(x,y,w,h,c)
105 #else
106 void V_FillRect(int scrn, int x, int y, int width, int height, byte colour);
107 #endif
109 // CPhipps - patch drawing
110 // Consolidated into the 3 really useful functions:
111 // V_DrawMemPatch - Draws the given patch_t
112 #ifdef GL_DOOM
113 #define V_DrawMemPatch(x,y,s,p,t,f) gld_DrawPatchFromMem(x,y,p,t,f)
114 #else
115 void V_DrawMemPatch(int x, int y, int scrn, const patch_t *patch,
116 int cm, patch_translation_e flags);
117 #endif
118 // V_DrawNumPatch - Draws the patch from lump num
119 #ifdef GL_DOOM
120 #define V_DrawNumPatch(x,y,s,l,t,f) gld_DrawNumPatch(x,y,l,t,f)
121 #else
122 void V_DrawNumPatch(int x, int y, int scrn, int lump,
123 int cm, patch_translation_e flags);
124 #endif
125 // V_DrawNamePatch - Draws the patch from lump "name"
126 #ifdef GL_DOOM
127 #define V_DrawNamePatch(x,y,s,n,t,f) gld_DrawNumPatch(x,y,W_GetNumForName(n),t,f)
128 #else
129 #define V_DrawNamePatch(x,y,s,n,t,f) V_DrawNumPatch(x,y,s,W_GetNumForName(n),t,f)
130 #endif
132 /* cph -
133 * Functions to return width & height of a patch.
134 * Doesn't really belong here, but is often used in conjunction with
135 * this code.
137 int V_NamePatchWidth(const char* name);
138 int V_NamePatchHeight(const char* name);
140 // Draw a linear block of pixels into the view buffer.
142 // CPhipps - added const's, patch translation flags for stretching
143 #ifndef GL_DOOM
144 void V_DrawBlock(int x, int y, int scrn, int width, int height,
145 const byte *src, patch_translation_e flags);
146 #endif
148 /* cphipps 10/99: function to tile a flat over the screen */
149 #ifdef GL_DOOM
150 #define V_DrawBackground(n,s) gld_DrawBackground(n)
151 #else
152 void V_DrawBackground(const char* flatname, int scrn);
153 #endif
155 // Reads a linear block of pixels into the view buffer.
157 #ifndef GL_DOOM
158 void V_GetBlock(int x, int y, int scrn, int width, int height, byte *dest);
160 void V_MarkRect(int x, int y, int width,int height);
162 // CPhipps - function to convert a patch_t into a simple block bitmap
163 // Returns pointer to the malloc()'ed bitmap, and its width and height
164 byte *V_PatchToBlock(const char* name, int cm,
165 patch_translation_e flags,
166 unsigned short* width, unsigned short* height);
167 #else
168 #define V_MarkRect(x,y,w,h)
169 #define V_PatchToBlock(n,cm,f,w,h) NULL
170 #endif
172 // CPhipps - function to set the palette to palette number pal.
173 void V_SetPalette(int pal);
175 // CPhipps - function to plot a pixel
177 #ifndef GL_DOOM
178 #define V_PlotPixel(s,x,y,c) d_screens[s][x+SCREENWIDTH*y]=c
179 #endif
181 #define V_AllocScreen(scrn) d_screens[scrn] = malloc(SCREENWIDTH*SCREENHEIGHT)
182 #define V_FreeScreen(scrn) free(d_screens[scrn]); d_screens[scrn] = NULL
184 #ifdef GL_DOOM
185 #include "gl_struct.h"
186 #endif
187 #endif