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 //jff 1/16/98 end palette color range additions
73 #define CR_DEFAULT CR_RED /* default value for out of range colors */
75 extern byte
*d_screens
[6];
76 extern int dirtybox
[4];
77 extern const byte gammatable
[5][256];
80 //jff 4/24/98 loads color translation lumps
81 void V_InitColorTranslation(void);
83 // Allocates buffer screens, call before R_Init.
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
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
);
98 #define V_CopyRect(sx,sy,ss,w,h,dx,dy,ds,f)
102 #define V_FillRect(s,x,y,w,h,c) gld_FillBlock(x,y,w,h,c)
104 void V_FillRect(int scrn
, int x
, int y
, int width
, int height
, byte colour
);
107 // CPhipps - patch drawing
108 // Consolidated into the 3 really useful functions:
109 // V_DrawMemPatch - Draws the given patch_t
111 #define V_DrawMemPatch(x,y,s,p,t,f) gld_DrawPatchFromMem(x,y,p,t,f)
113 void V_DrawMemPatch(int x
, int y
, int scrn
, const patch_t
*patch
,
114 int cm
, enum patch_translation_e flags
);
116 // V_DrawNumPatch - Draws the patch from lump num
118 #define V_DrawNumPatch(x,y,s,l,t,f) gld_DrawNumPatch(x,y,l,t,f)
120 void V_DrawNumPatch(int x
, int y
, int scrn
, int lump
,
121 int cm
, enum patch_translation_e flags
);
123 // V_DrawNamePatch - Draws the patch from lump "name"
125 #define V_DrawNamePatch(x,y,s,n,t,f) gld_DrawNumPatch(x,y,W_GetNumForName(n),t,f)
127 #define V_DrawNamePatch(x,y,s,n,t,f) V_DrawNumPatch(x,y,s,W_GetNumForName(n),t,f)
131 * Functions to return width & height of a patch.
132 * Doesn't really belong here, but is often used in conjunction with
135 int V_NamePatchWidth(const char* name
);
136 int V_NamePatchHeight(const char* name
);
138 // Draw a linear block of pixels into the view buffer.
140 // CPhipps - added const's, patch translation flags for stretching
142 void V_DrawBlock(int x
, int y
, int scrn
, int width
, int height
,
143 const byte
*src
, enum patch_translation_e flags
);
146 /* cphipps 10/99: function to tile a flat over the screen */
148 #define V_DrawBackground(n,s) gld_DrawBackground(n)
150 void V_DrawBackground(const char* flatname
, int scrn
);
153 // Reads a linear block of pixels into the view buffer.
156 void V_GetBlock(int x
, int y
, int scrn
, int width
, int height
, byte
*dest
);
158 void V_MarkRect(int x
, int y
, int width
,int height
);
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
);
166 #define V_MarkRect(x,y,w,h)
167 #define V_PatchToBlock(n,cm,f,w,h) NULL
170 // CPhipps - function to set the palette to palette number pal.
171 void V_SetPalette(int pal
);
173 // CPhipps - function to plot a pixel
176 #define V_PlotPixel(s,x,y,c) d_screens[s][x+SCREENWIDTH*y]=c
179 #define V_AllocScreen(scrn) d_screens[scrn] = malloc(SCREENWIDTH*SCREENHEIGHT)
180 #define V_FreeScreen(scrn) free(d_screens[scrn]); d_screens[scrn] = NULL
183 #include "gl_struct.h"