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
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 *-----------------------------------------------------------------------------*/
40 // Needed because we are refering to patches.
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
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];
81 //jff 4/24/98 loads color translation lumps
82 void V_InitColorTranslation(void);
84 // Allocates buffer screens, call before R_Init.
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
;
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
);
100 #define V_CopyRect(sx,sy,ss,w,h,dx,dy,ds,f)
104 #define V_FillRect(s,x,y,w,h,c) gld_FillBlock(x,y,w,h,c)
106 void V_FillRect(int scrn
, int x
, int y
, int width
, int height
, byte colour
);
109 // CPhipps - patch drawing
110 // Consolidated into the 3 really useful functions:
111 // V_DrawMemPatch - Draws the given patch_t
113 #define V_DrawMemPatch(x,y,s,p,t,f) gld_DrawPatchFromMem(x,y,p,t,f)
115 void V_DrawMemPatch(int x
, int y
, int scrn
, const patch_t
*patch
,
116 int cm
, patch_translation_e flags
);
118 // V_DrawNumPatch - Draws the patch from lump num
120 #define V_DrawNumPatch(x,y,s,l,t,f) gld_DrawNumPatch(x,y,l,t,f)
122 void V_DrawNumPatch(int x
, int y
, int scrn
, int lump
,
123 int cm
, patch_translation_e flags
);
125 // V_DrawNamePatch - Draws the patch from lump "name"
127 #define V_DrawNamePatch(x,y,s,n,t,f) gld_DrawNumPatch(x,y,W_GetNumForName(n),t,f)
129 #define V_DrawNamePatch(x,y,s,n,t,f) V_DrawNumPatch(x,y,s,W_GetNumForName(n),t,f)
133 * Functions to return width & height of a patch.
134 * Doesn't really belong here, but is often used in conjunction with
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
144 void V_DrawBlock(int x
, int y
, int scrn
, int width
, int height
,
145 const byte
*src
, patch_translation_e flags
);
148 /* cphipps 10/99: function to tile a flat over the screen */
150 #define V_DrawBackground(n,s) gld_DrawBackground(n)
152 void V_DrawBackground(const char* flatname
, int scrn
);
155 // Reads a linear block of pixels into the view buffer.
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
);
168 #define V_MarkRect(x,y,w,h)
169 #define V_PatchToBlock(n,cm,f,w,h) NULL
172 // CPhipps - function to set the palette to palette number pal.
173 void V_SetPalette(int pal
);
175 // CPhipps - function to plot a pixel
178 #define V_PlotPixel(s,x,y,c) d_screens[s][x+SCREENWIDTH*y]=c
181 #define V_AllocScreen(scrn) d_screens[scrn] = malloc(SCREENWIDTH*SCREENHEIGHT)
182 #define V_FreeScreen(scrn) free(d_screens[scrn]); d_screens[scrn] = NULL
185 #include "gl_struct.h"