Debian Codegraph @

prboom2/src/r_main.h

raw
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 extern int r_frame_count;
41
42 //
43 // POV related.
44 //
45
46 extern fixed_t viewcos;
47 extern fixed_t viewsin;
48 extern fixed_t viewtancos;
49 extern fixed_t viewtansin;
50 extern int viewwidth;
51 extern int viewheight;
52 extern int centerx;
53 extern int centery;
54 extern fixed_t globaluclip;
55 extern fixed_t globaldclip;
56 extern fixed_t centerxfrac;
57 extern fixed_t centeryfrac;
58 extern fixed_t yaspectmul;
59 extern fixed_t viewheightfrac; //e6y: for correct cliping of things
60 extern fixed_t projection;
61 extern fixed_t skyiscale;
62 // e6y: wide-res
63 extern int wide_centerx;
64 #define RMUL (1.6f/1.333333f)
65
66 // proff 11/06/98: Added for high-res
67 extern fixed_t projectiony;
68 extern int validcount;
69 extern int validcount2;
70 // e6y: Added for more precise flats drawing
71 extern fixed_t viewfocratio;
72
73 //
74 // Lighting LUT.
75 // Used for z-depth cuing per column/row,
76 // and other lighting effects (sector ambient, flash).
77 //
78
79 // Lighting constants.
80
81 // SoM: I am really speechless at this... just... why?
82 // Lighting in doom was originally clamped off to just 16 brightness levels
83 // for sector lighting. Simply changing the constants is enough to change this
84 // it seriously bottles the mind why this wasn't done in doom from the start
85 // except for maybe memory usage savings.
86 #define LIGHTLEVELS_MAX 32
87
88 extern int LIGHTSEGSHIFT;
89 extern int LIGHTBRIGHT;
90 extern int LIGHTLEVELS;
91
92 #define MAXLIGHTSCALE 48
93 #define LIGHTSCALESHIFT 12
94 #define MAXLIGHTZ 128
95 #define LIGHTZSHIFT 20
96
97 // killough 3/20/98: Allow colormaps to be dynamic (e.g. underwater)
98 extern const lighttable_t *(*scalelight)[MAXLIGHTSCALE];
99 extern const lighttable_t *(*c_zlight)[LIGHTLEVELS_MAX][MAXLIGHTZ];
100 extern const lighttable_t *(*zlight)[MAXLIGHTZ];
101 extern const lighttable_t *fullcolormap;
102 extern int numcolormaps; // killough 4/4/98: dynamic number of maps
103 extern const lighttable_t **colormaps;
104 // killough 3/20/98, 4/4/98: end dynamic colormaps
105
106 extern const byte* colormap_lump;
107
108 //e6y: for Boom colormaps in OpenGL mode
109 extern dboolean use_boom_cm;
110 extern int boom_cm; // current colormap
111 extern int frame_fixedcolormap;
112
113 extern int extralight;
114 extern const lighttable_t *fixedcolormap;
115
116 // Number of diminishing brightness levels.
117 // There a 0-31, i.e. 32 LUT in the COLORMAP lump.
118
119 #define NUMCOLORMAPS 32
120 // Index of the special effects (INVUL inverse) map.
121 #define INVERSECOLORMAP 32
122
123 //
124 // Utility functions.
125 //
126
127 PUREFUNC int R_CompatiblePointOnSide(fixed_t x, fixed_t y, const node_t *node);
128 PUREFUNC int R_ZDoomPointOnSide(fixed_t x, fixed_t y, const node_t *node);
129 extern int (*R_PointOnSide)(fixed_t x, fixed_t y, const node_t *node);
130
131 PUREFUNC int R_CompatiblePointOnSegSide(fixed_t x, fixed_t y, const seg_t *line);
132 PUREFUNC int R_ZDoomPointOnSegSide(fixed_t x, fixed_t y, const seg_t *line);
133 extern int (*R_PointOnSegSide)(fixed_t x, fixed_t y, const seg_t *line);
134
135 angle_t R_PointToAngle2(fixed_t x1, fixed_t y1, fixed_t x, fixed_t y);
136 subsector_t *R_PointInSubsector(fixed_t x, fixed_t y);
137 sector_t *R_PointInSector(fixed_t x, fixed_t y);
138 void R_SectorCenter(fixed_t *x, fixed_t *y, sector_t *sec);
139 void R_LineCenter(fixed_t *x, fixed_t *y, line_t *line);
140
141 //e6y: made more precise
142 angle_t R_PointToAngleEx(fixed_t x, fixed_t y);
143 angle_t R_PointToAngleEx2(fixed_t x1, fixed_t y1, fixed_t x, fixed_t y);
144 angle_t R_PointToPseudoAngle(fixed_t x, fixed_t y);
145
146 //
147 // REFRESH - the actual rendering functions.
148 //
149
150 void R_ResetColorMap(void);
151 void R_RenderPlayerView(player_t *player); // Called by G_Drawer.
152 void R_Init(void); // Called by startup code.
153 void R_SetViewSize(void); // Called by M_Responder.
154 void R_ExecuteSetViewSize(void); // cph - called by D_Display to complete a view resize
155 dboolean R_FullView(void);
156 dboolean R_PartialView(void);
157 dboolean R_StatusBarVisible(void);
158
159 #define Pi 3.14159265358979323846f
160 #define DEG2RAD(a) ((a * Pi) / 180.0f)
161 #define RAD2DEG(a) ((a / Pi) * 180.0f)
162 #define MAP_COEFF 128.0f
163 #define MAP_SCALE (MAP_COEFF*(float)FRACUNIT)
164
165 extern int viewport[4];
166 extern float modelMatrix[16];
167 extern float projMatrix[16];
168 int R_Project(float objx, float objy, float objz, float *winx, float *winy, float *winz);
169
170 #endif