Odamex
Setting the Standard in Multiplayer Doom
common/r_main.h
Go to the documentation of this file.
00001 // Emacs style mode select   -*- C++ -*-
00002 //-----------------------------------------------------------------------------
00003 //
00004 // $Id: r_main.h 1856 2010-09-05 03:14:13Z ladna $
00005 //
00006 // Copyright (C) 1993-1996 by id Software, Inc.
00007 // Copyright (C) 2006-2010 by The Odamex Team.
00008 //
00009 // This program is free software; you can redistribute it and/or
00010 // modify it under the terms of the GNU General Public License
00011 // as published by the Free Software Foundation; either version 2
00012 // of the License, or (at your option) any later version.
00013 //
00014 // This program is distributed in the hope that it will be useful,
00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 // GNU General Public License for more details.
00018 //
00019 // DESCRIPTION:
00020 //      System specific interface stuff.
00021 //
00022 //-----------------------------------------------------------------------------
00023 
00024 
00025 #ifndef __R_MAIN_H__
00026 #define __R_MAIN_H__
00027 
00028 #include "d_player.h"
00029 #include "r_data.h"
00030 
00031 // killough 10/98: special mask indicates sky flat comes from sidedef
00032 #define PL_SKYFLAT (0x80000000)
00033 
00034 BOOL R_AlignFlat (int linenum, int side, int fc);
00035 
00036 //
00037 // POV related.
00038 //
00039 extern fixed_t                  viewcos;
00040 extern fixed_t                  viewsin;
00041 
00042 extern int                              viewwidth;
00043 extern int                              viewheight;
00044 extern int                              viewwindowx;
00045 extern int                              viewwindowy;
00046 
00047 
00048 
00049 extern int                              centerx;
00050 extern "C" int                  centery;
00051 
00052 extern fixed_t                  centerxfrac;
00053 extern fixed_t                  centeryfrac;
00054 extern fixed_t                  yaspectmul;
00055 
00056 extern byte*                    basecolormap;   // [RH] Colormap for sector currently being drawn
00057 
00058 extern int                              validcount;
00059 
00060 extern int                              linecount;
00061 extern int                              loopcount;
00062 
00063 //
00064 // Lighting LUT.
00065 // Used for z-depth cuing per column/row,
00066 //      and other lighting effects (sector ambient, flash).
00067 //
00068 
00069 // Lighting constants.
00070 // Now why not 32 levels here?
00071 #define LIGHTLEVELS                     16
00072 #define LIGHTSEGSHIFT                    4
00073 
00074 #define MAXLIGHTSCALE                   48
00075 #define LIGHTSCALEMULBITS                8      // [RH] for hires lighting fix
00076 #define LIGHTSCALESHIFT                 (12+LIGHTSCALEMULBITS)
00077 #define MAXLIGHTZ                          128
00078 #define LIGHTZSHIFT                     20
00079 
00080 // [RH] Changed from lighttable_t* to int.
00081 extern int                              scalelight[LIGHTLEVELS][MAXLIGHTSCALE];
00082 extern int                              scalelightfixed[MAXLIGHTSCALE];
00083 extern int                              zlight[LIGHTLEVELS][MAXLIGHTZ];
00084 
00085 extern int                              extralight;
00086 extern BOOL                             foggy;
00087 extern int                              fixedlightlev;
00088 extern lighttable_t*    fixedcolormap;
00089 
00090 extern int                              lightscalexmul; // [RH] for hires lighting fix
00091 extern int                              lightscaleymul;
00092 
00093 
00094 // Number of diminishing brightness levels.
00095 // There a 0-31, i.e. 32 LUT in the COLORMAP lump.
00096 #define NUMCOLORMAPS                    32
00097 
00098 
00099 // [RH] New detail modes
00100 extern "C" int                  detailxshift;
00101 extern "C" int                  detailyshift;
00102 
00103 
00104 //
00105 // Function pointers to switch refresh/drawing functions.
00106 // Used to select shadow mode etc.
00107 //
00108 extern void                     (*colfunc) (void);
00109 extern void                     (*basecolfunc) (void);
00110 extern void                     (*fuzzcolfunc) (void);
00111 extern void                             (*lucentcolfunc) (void);
00112 extern void                             (*transcolfunc) (void);
00113 extern void                             (*tlatedlucentcolfunc) (void);
00114 // No shadow effects on floors.
00115 extern void                     (*spanfunc) (void);
00116 
00117 // [RH] Function pointers for the horizontal column drawers.
00118 extern void (*hcolfunc_pre) (void);
00119 extern void (*hcolfunc_post1) (int hx, int sx, int yl, int yh);
00120 extern void (*hcolfunc_post2) (int hx, int sx, int yl, int yh);
00121 extern void (*hcolfunc_post4) (int sx, int yl, int yh);
00122 
00123 
00124 
00125 //
00126 // Utility functions.
00127 
00128 int
00129 R_PointOnSide
00130 ( fixed_t       x,
00131   fixed_t       y,
00132   node_t*       node );
00133 
00134 int
00135 R_PointOnSegSide
00136 ( fixed_t       x,
00137   fixed_t       y,
00138   seg_t*        line );
00139 
00140 angle_t
00141 R_PointToAngle
00142 ( fixed_t       x,
00143   fixed_t       y );
00144 
00145 // 2/1/10: Updated (from EE) to restore vanilla style, with tweak for overflow tolerance
00146 angle_t R_PointToAngle2(fixed_t viewx, fixed_t viewy, fixed_t x, fixed_t y);
00147 
00148 fixed_t
00149 R_PointToDist
00150 ( fixed_t       x,
00151   fixed_t       y );
00152 
00153 
00154 fixed_t R_ScaleFromGlobalAngle (angle_t visangle);
00155 
00156 subsector_t*
00157 R_PointInSubsector
00158 ( fixed_t       x,
00159   fixed_t       y );
00160 
00161 void
00162 R_AddPointToBox
00163 ( int           x,
00164   int           y,
00165   fixed_t*      box );
00166 
00167 fixed_t R_PointToDist2 (fixed_t dx, fixed_t dy);
00168 void R_SetFOV (float fov);
00169 float R_GetFOV (void);
00170 
00171 //
00172 // REFRESH - the actual rendering functions.
00173 //
00174 
00175 // Called by G_Drawer.
00176 void R_RenderPlayerView (player_t *player);
00177 
00178 // Called by startup code.
00179 void R_Init (void);
00180 
00181 // Called by exit code.
00182 void R_Shutdown (void);
00183 
00184 // Called by M_Responder.
00185 void R_SetViewSize (int blocks);
00186 
00187 // [RH] Initialize multires stuff for renderer
00188 void R_MultiresInit (void);
00189 
00190 #endif // __R_MAIN_H__
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends