doom3-bfg/doomclassic/doom/r_main.h

187 lines
4.1 KiB
C
Raw Normal View History

2012-11-26 18:58:24 +00:00
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#ifndef __R_MAIN__
#define __R_MAIN__
#include "d_player.h"
#include "r_data.h"
#ifdef __GNUG__
#pragma interface
#endif
//
// POV related.
//
extern fixed_t viewcos;
extern fixed_t viewsin;
extern int viewwidth;
extern int viewheight;
extern int viewwindowx;
extern int viewwindowy;
extern int centerx;
extern int centery;
extern fixed_t centerxfrac;
extern fixed_t centeryfrac;
extern fixed_t projection;
extern int validcount;
extern int linecount;
extern int loopcount;
//
// Lighting LUT.
// Used for z-depth cuing per column/row,
// and other lighting effects (sector ambient, flash).
//
// Lighting constants.
// Now why not 32 levels here?
#define LIGHTLEVELS 16
#define LIGHTSEGSHIFT 4
#define MAXLIGHTSCALE 48
#define LIGHTSCALESHIFT 12
#define MAXLIGHTZ 128
#define LIGHTZSHIFT 20
extern lighttable_t* scalelight[LIGHTLEVELS][MAXLIGHTSCALE];
extern lighttable_t* scalelightfixed[MAXLIGHTSCALE];
extern lighttable_t* zlight[LIGHTLEVELS][MAXLIGHTZ];
extern int extralight;
extern lighttable_t* fixedcolormap;
// Number of diminishing brightness levels.
// There a 0-31, i.e. 32 LUT in the COLORMAP lump.
#define NUMCOLORMAPS 32
// Blocky/low detail mode.
//B remove this?
// 0 = high, 1 = low
extern int detailshift;
//
// Function pointers to switch refresh/drawing functions.
// Used to select shadow mode etc.
//
extern void (*colfunc) ( lighttable_t * ds_colormap,
byte * ds_source );
extern void (*basecolfunc) ( lighttable_t * ds_colormap,
byte * ds_source );
extern void (*fuzzcolfunc) ( lighttable_t * ds_colormap,
byte * ds_source );
// No shadow effects on floors.
extern void (*spanfunc) (
fixed_t xfrac,
fixed_t yfrac,
fixed_t ds_y,
int ds_x1,
int ds_x2,
fixed_t ds_xstep,
fixed_t ds_ystep,
lighttable_t * ds_colormap,
byte * ds_source );
//
// Utility functions.
int
R_PointOnSide
( fixed_t x,
fixed_t y,
node_t* node );
int
R_PointOnSegSide
( fixed_t x,
fixed_t y,
seg_t* line );
angle_t
R_PointToAngle
( fixed_t x,
fixed_t y );
angle_t
R_PointToAngle2
( fixed_t x1,
fixed_t y1,
fixed_t x2,
fixed_t y2 );
fixed_t
R_PointToDist
( fixed_t x,
fixed_t y );
fixed_t R_ScaleFromGlobalAngle (angle_t visangle);
subsector_t*
R_PointInSubsector
( fixed_t x,
fixed_t y );
void
R_AddPointToBox
( int x,
int y,
fixed_t* box );
//
// REFRESH - the actual rendering functions.
//
// Called by G_Drawer.
void R_RenderPlayerView (player_t *player);
// Called by startup code.
void R_Init (void);
// Called by M_Responder.
void R_SetViewSize (int blocks, int detail);
#endif