2014-03-15 16:59:03 +00:00
|
|
|
// SONIC ROBO BLAST 2
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
|
|
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
2020-02-19 22:08:45 +00:00
|
|
|
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
2014-03-15 16:59:03 +00:00
|
|
|
//
|
|
|
|
// This program is free software distributed under the
|
|
|
|
// terms of the GNU General Public License, version 2.
|
|
|
|
// See the 'LICENSE' file for more details.
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
/// \file r_main.h
|
|
|
|
/// \brief Rendering variables, consvars, defines
|
|
|
|
|
|
|
|
#ifndef __R_MAIN__
|
|
|
|
#define __R_MAIN__
|
|
|
|
|
|
|
|
#include "d_player.h"
|
|
|
|
#include "r_data.h"
|
2020-01-07 15:35:10 +00:00
|
|
|
#include "r_textures.h"
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// POV related.
|
|
|
|
//
|
|
|
|
extern fixed_t viewcos, viewsin;
|
|
|
|
extern INT32 viewheight;
|
|
|
|
extern INT32 centerx, centery;
|
|
|
|
|
|
|
|
extern fixed_t centerxfrac, centeryfrac;
|
|
|
|
extern fixed_t projection, projectiony;
|
2020-01-16 19:56:11 +00:00
|
|
|
extern fixed_t fovtan;
|
|
|
|
|
|
|
|
// WARNING: a should be unsigned but to add with 2048, it isn't!
|
2020-01-23 22:44:46 +00:00
|
|
|
#define AIMINGTODY(a) FixedDiv((FINETANGENT((2048+(((INT32)a)>>ANGLETOFINESHIFT)) & FINEMASK)*160), fovtan)
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
extern size_t validcount, linecount, loopcount, framecount;
|
|
|
|
|
|
|
|
//
|
|
|
|
// Lighting LUT.
|
|
|
|
// Used for z-depth cuing per column/row,
|
|
|
|
// and other lighting effects (sector ambient, flash).
|
|
|
|
//
|
|
|
|
|
|
|
|
// Lighting constants.
|
|
|
|
// Now with 32 levels.
|
|
|
|
#define LIGHTLEVELS 32
|
|
|
|
#define LIGHTSEGSHIFT 3
|
|
|
|
|
|
|
|
#define MAXLIGHTSCALE 48
|
|
|
|
#define LIGHTSCALESHIFT 12
|
|
|
|
#define MAXLIGHTZ 128
|
|
|
|
#define LIGHTZSHIFT 20
|
|
|
|
|
2020-01-18 06:16:18 +00:00
|
|
|
#define LIGHTRESOLUTIONFIX (640*fovtan/vid.width)
|
|
|
|
|
2014-03-15 16:59:03 +00:00
|
|
|
extern lighttable_t *scalelight[LIGHTLEVELS][MAXLIGHTSCALE];
|
|
|
|
extern lighttable_t *scalelightfixed[MAXLIGHTSCALE];
|
|
|
|
extern lighttable_t *zlight[LIGHTLEVELS][MAXLIGHTZ];
|
|
|
|
|
|
|
|
// Number of diminishing brightness levels.
|
|
|
|
// There a 0-31, i.e. 32 LUT in the COLORMAP lump.
|
|
|
|
#define NUMCOLORMAPS 32
|
|
|
|
|
|
|
|
// Utility functions.
|
|
|
|
INT32 R_PointOnSide(fixed_t x, fixed_t y, node_t *node);
|
|
|
|
INT32 R_PointOnSegSide(fixed_t x, fixed_t y, seg_t *line);
|
|
|
|
angle_t R_PointToAngle(fixed_t x, fixed_t y);
|
2020-07-25 18:50:24 +00:00
|
|
|
angle_t R_PointToAngle64(INT64 x, INT64 y);
|
2014-03-15 16:59:03 +00:00
|
|
|
angle_t R_PointToAngle2(fixed_t px2, fixed_t py2, fixed_t px1, fixed_t py1);
|
2018-12-09 22:34:17 +00:00
|
|
|
angle_t R_PointToAngleEx(INT32 x2, INT32 y2, INT32 x1, INT32 y1);
|
2014-03-15 16:59:03 +00:00
|
|
|
fixed_t R_PointToDist(fixed_t x, fixed_t y);
|
|
|
|
fixed_t R_PointToDist2(fixed_t px2, fixed_t py2, fixed_t px1, fixed_t py1);
|
|
|
|
|
|
|
|
fixed_t R_ScaleFromGlobalAngle(angle_t visangle);
|
|
|
|
subsector_t *R_PointInSubsector(fixed_t x, fixed_t y);
|
2020-01-22 15:58:57 +00:00
|
|
|
subsector_t *R_PointInSubsectorOrNull(fixed_t x, fixed_t y);
|
2014-03-15 16:59:03 +00:00
|
|
|
|
2014-11-12 00:55:07 +00:00
|
|
|
boolean R_DoCulling(line_t *cullheight, line_t *viewcullheight, fixed_t vz, fixed_t bottomh, fixed_t toph);
|
|
|
|
|
2020-05-01 17:57:48 +00:00
|
|
|
// Render stats
|
|
|
|
|
2020-10-10 18:08:24 +00:00
|
|
|
extern int ps_prevframetime;// time when previous frame was rendered
|
|
|
|
extern int ps_rendercalltime;
|
|
|
|
extern int ps_uitime;
|
|
|
|
extern int ps_swaptime;
|
|
|
|
|
|
|
|
extern int ps_bsptime;
|
|
|
|
|
|
|
|
extern int ps_sw_spritecliptime;
|
|
|
|
extern int ps_sw_portaltime;
|
|
|
|
extern int ps_sw_planetime;
|
|
|
|
extern int ps_sw_maskedtime;
|
|
|
|
|
|
|
|
extern int ps_numbspcalls;
|
|
|
|
extern int ps_numsprites;
|
|
|
|
extern int ps_numdrawnodes;
|
|
|
|
extern int ps_numpolyobjects;
|
2020-05-02 17:43:53 +00:00
|
|
|
|
2014-03-15 16:59:03 +00:00
|
|
|
//
|
|
|
|
// REFRESH - the actual rendering functions.
|
|
|
|
//
|
|
|
|
|
2014-03-21 18:42:55 +00:00
|
|
|
extern consvar_t cv_showhud, cv_translucenthud;
|
2014-03-15 16:59:03 +00:00
|
|
|
extern consvar_t cv_homremoval;
|
|
|
|
extern consvar_t cv_chasecam, cv_chasecam2;
|
|
|
|
extern consvar_t cv_flipcam, cv_flipcam2;
|
2020-01-18 03:19:51 +00:00
|
|
|
|
2019-11-17 22:18:46 +00:00
|
|
|
extern consvar_t cv_shadow;
|
2020-10-10 04:00:39 +00:00
|
|
|
extern consvar_t cv_ffloorclip;
|
2015-01-01 19:50:31 +00:00
|
|
|
extern consvar_t cv_translucency;
|
2019-06-18 12:33:35 +00:00
|
|
|
extern consvar_t cv_drawdist, cv_drawdist_nights, cv_drawdist_precip;
|
2019-12-31 17:21:46 +00:00
|
|
|
extern consvar_t cv_fov;
|
2014-03-15 16:59:03 +00:00
|
|
|
extern consvar_t cv_skybox;
|
|
|
|
extern consvar_t cv_tailspickup;
|
|
|
|
|
|
|
|
// Called by startup code.
|
|
|
|
void R_Init(void);
|
2019-09-08 21:27:35 +00:00
|
|
|
#ifdef HWRENDER
|
|
|
|
void R_InitHardwareMode(void);
|
|
|
|
#endif
|
|
|
|
void R_ReloadHUDGraphics(void);
|
2014-03-15 16:59:03 +00:00
|
|
|
|
2020-01-15 05:29:56 +00:00
|
|
|
void R_CheckViewMorph(void);
|
|
|
|
void R_ApplyViewMorph(void);
|
|
|
|
|
2014-03-15 16:59:03 +00:00
|
|
|
// just sets setsizeneeded true
|
|
|
|
extern boolean setsizeneeded;
|
|
|
|
void R_SetViewSize(void);
|
|
|
|
|
|
|
|
// do it (sometimes explicitly called)
|
|
|
|
void R_ExecuteSetViewSize(void);
|
|
|
|
|
2020-02-08 20:42:26 +00:00
|
|
|
void R_SetupFrame(player_t *player);
|
2014-03-20 20:13:15 +00:00
|
|
|
void R_SkyboxFrame(player_t *player);
|
2020-02-08 20:49:27 +00:00
|
|
|
|
|
|
|
boolean R_ViewpointHasChasecam(player_t *player);
|
2020-02-08 21:08:56 +00:00
|
|
|
boolean R_IsViewpointThirdPerson(player_t *player, boolean skybox);
|
2014-03-20 20:13:15 +00:00
|
|
|
|
2020-02-08 20:42:26 +00:00
|
|
|
// Called by D_Display.
|
2014-03-15 16:59:03 +00:00
|
|
|
void R_RenderPlayerView(player_t *player);
|
|
|
|
|
|
|
|
// add commands related to engine, at game startup
|
|
|
|
void R_RegisterEngineStuff(void);
|
|
|
|
#endif
|