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 * DESCRIPTION: 30 * Renderer main interface. 31 * 32 *-----------------------------------------------------------------------------*/ 33 34 #ifndef __R_MAIN__ 35 #define __R_MAIN__ 36 37 #include "d_player.h" 38 #include "r_data.h" 39 40 #ifdef __GNUG__ 41 #pragma interface 42 #endif 43 44 extern int r_frame_count; 45 46 // 47 // POV related. 48 // 49 50 extern fixed_t viewcos; 51 extern fixed_t viewsin; 52 extern int viewwidth; 53 extern int viewheight; 54 extern int viewwindowx; 55 extern int viewwindowy; 56 extern int centerx; 57 extern int centery; 58 extern fixed_t centerxfrac; 59 extern fixed_t centeryfrac; 60 extern fixed_t viewheightfrac; //e6y: for correct cliping of things 61 extern fixed_t projection; 62 extern fixed_t skyiscale; 63 // e6y: wide-res 64 extern int wide_centerx; 65 extern int wide_ratio; 66 extern int wide_offsetx; 67 extern int wide_offset2x; 68 extern int wide_offsety; 69 extern int wide_offset2y; 70 #define RMUL (1.6f/1.333333f) 71 typedef struct base_ratio_s 72 { 73 int base_width; // Base width (unused) 74 int base_height; // Base height (used for wall visibility multiplier) 75 int psprite_offset; // Psprite offset (needed for "tallscreen" modes) 76 int multiplier; // Width or height multiplier 77 float gl_ratio; 78 } base_ratio_t; 79 extern const base_ratio_t BaseRatioSizes[]; 80 81 // proff 11/06/98: Added for high-res 82 extern fixed_t projectiony; 83 extern int validcount; 84 // e6y: Added for more precise flats drawing 85 extern float viewfocratio; 86 87 // 88 // Rendering stats 89 // 90 91 extern int rendered_visplanes, rendered_segs, rendered_vissprites; 92 extern dboolean rendering_stats; 93 94 // 95 // Lighting LUT. 96 // Used for z-depth cuing per column/row, 97 // and other lighting effects (sector ambient, flash). 98 // 99 100 // Lighting constants. 101 102 // SoM: I am really speechless at this... just... why? 103 // Lighting in doom was originally clamped off to just 16 brightness levels 104 // for sector lighting. Simply changing the constants is enough to change this 105 // it seriously bottles the mind why this wasn't done in doom from the start 106 // except for maybe memory usage savings. 107 #define LIGHTLEVELS_MAX 32 108 109 extern int LIGHTSEGSHIFT; 110 extern int LIGHTBRIGHT; 111 extern int LIGHTLEVELS; 112 extern int render_doom_lightmaps; 113 114 #define MAXLIGHTSCALE 48 115 #define LIGHTSCALESHIFT 12 116 #define MAXLIGHTZ 128 117 #define LIGHTZSHIFT 20 118 119 /* cph - allow crappy fake contrast to be disabled */ 120 extern int fake_contrast; 121 122 // killough 3/20/98: Allow colormaps to be dynamic (e.g. underwater) 123 extern const lighttable_t *(*scalelight)[MAXLIGHTSCALE]; 124 extern const lighttable_t *(*c_zlight)[LIGHTLEVELS_MAX][MAXLIGHTZ]; 125 extern const lighttable_t *(*zlight)[MAXLIGHTZ]; 126 extern const lighttable_t *fullcolormap; 127 extern int numcolormaps; // killough 4/4/98: dynamic number of maps 128 extern const lighttable_t **colormaps; 129 // killough 3/20/98, 4/4/98: end dynamic colormaps 130 131 //e6y: for Boom colormaps in OpenGL mode 132 extern dboolean use_boom_cm; 133 extern int boom_cm; // current colormap 134 extern int frame_fixedcolormap; 135 136 extern int extralight; 137 extern const lighttable_t *fixedcolormap; 138 139 // Number of diminishing brightness levels. 140 // There a 0-31, i.e. 32 LUT in the COLORMAP lump. 141 142 #define NUMCOLORMAPS 32 143 // Index of the special effects (INVUL inverse) map. 144 #define INVERSECOLORMAP 32 145 146 // 147 // Utility functions. 148 // 149 150 PUREFUNC int R_PointOnSide(fixed_t x, fixed_t y, const node_t *node); 151 PUREFUNC int R_PointOnSegSide(fixed_t x, fixed_t y, const seg_t *line); 152 angle_t R_PointToAngle(fixed_t x, fixed_t y); 153 angle_t R_PointToAngle2(fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2); 154 subsector_t *R_PointInSubsector(fixed_t x, fixed_t y); 155 156 //e6y: made more precise 157 angle_t R_PointToAngleEx(fixed_t x, fixed_t y); 158 //e6y: caching 159 angle_t R_GetVertexViewAngle(vertex_t *v); 160 angle_t R_GetVertexViewAngleGL(vertex_t *v); 161 angle_t R_PointToPseudoAngle(fixed_t x, fixed_t y); 162 163 //e6y 164 typedef enum { render_precise_speed, render_precise_quality } render_precise_t; 165 extern render_precise_t render_precise; 166 extern const char *render_precises[]; 167 168 extern int r_have_internal_hires; 169 170 // 171 // REFRESH - the actual rendering functions. 172 // 173 174 void R_RenderPlayerView(player_t *player); // Called by G_Drawer. 175 void R_Init(void); // Called by startup code. 176 void R_SetViewSize(int blocks); // Called by M_Responder. 177 void R_ExecuteSetViewSize(void); // cph - called by D_Display to complete a view resize 178 179 void R_ShowStats(void); 180 void R_ClearStats(void); 181 182 #endif 183