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.
|
2018-11-25 12:35:38 +00:00
|
|
|
// Copyright (C) 1999-2018 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_plane.h
|
|
|
|
/// \brief Refresh, visplane stuff (floor, ceilings)
|
|
|
|
|
|
|
|
#ifndef __R_PLANE__
|
|
|
|
#define __R_PLANE__
|
|
|
|
|
|
|
|
#include "screen.h" // needs MAXVIDWIDTH/MAXVIDHEIGHT
|
|
|
|
#include "r_data.h"
|
|
|
|
#include "p_polyobj.h"
|
|
|
|
|
|
|
|
//
|
|
|
|
// Now what is a visplane, anyway?
|
|
|
|
// Simple: kinda floor/ceiling polygon optimised for SRB2 rendering.
|
2016-05-12 17:02:44 +00:00
|
|
|
// 7764 bytes! (for win32, anyway)
|
2014-03-15 16:59:03 +00:00
|
|
|
//
|
|
|
|
typedef struct visplane_s
|
|
|
|
{
|
|
|
|
struct visplane_s *next;
|
|
|
|
|
2016-04-04 19:49:01 +00:00
|
|
|
fixed_t height;
|
|
|
|
fixed_t viewx, viewy, viewz;
|
2014-03-15 16:59:03 +00:00
|
|
|
angle_t viewangle;
|
|
|
|
angle_t plangle;
|
|
|
|
INT32 picnum;
|
|
|
|
INT32 lightlevel;
|
|
|
|
INT32 minx, maxx;
|
|
|
|
|
|
|
|
// colormaps per sector
|
|
|
|
extracolormap_t *extra_colormap;
|
2018-12-14 17:08:25 +00:00
|
|
|
UINT16 padding;
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
UINT16 top[MAXVIDWIDTH];
|
|
|
|
UINT16 bottom[MAXVIDWIDTH];
|
|
|
|
INT32 high, low; // R_PlaneBounds should set these.
|
|
|
|
|
|
|
|
fixed_t xoffs, yoffs; // Scrolling flats.
|
|
|
|
|
|
|
|
struct ffloor_s *ffloor;
|
|
|
|
#ifdef POLYOBJECTS_PLANES
|
2014-11-12 00:55:07 +00:00
|
|
|
polyobj_t *polyobj;
|
2014-03-15 16:59:03 +00:00
|
|
|
#endif
|
2015-04-20 07:10:14 +00:00
|
|
|
#ifdef ESLOPE
|
|
|
|
pslope_t *slope;
|
|
|
|
#endif
|
2014-03-15 16:59:03 +00:00
|
|
|
} visplane_t;
|
|
|
|
|
|
|
|
extern visplane_t *floorplane;
|
|
|
|
extern visplane_t *ceilingplane;
|
|
|
|
|
|
|
|
// Visplane related.
|
|
|
|
extern INT16 *lastopening, *openings;
|
|
|
|
extern size_t maxopenings;
|
|
|
|
|
|
|
|
extern INT16 floorclip[MAXVIDWIDTH], ceilingclip[MAXVIDWIDTH];
|
2018-12-14 17:08:25 +00:00
|
|
|
extern fixed_t frontscale[MAXVIDWIDTH], yslopetab[MAXVIDHEIGHT*16];
|
2014-03-15 16:59:03 +00:00
|
|
|
extern fixed_t cachedheight[MAXVIDHEIGHT];
|
|
|
|
extern fixed_t cacheddistance[MAXVIDHEIGHT];
|
|
|
|
extern fixed_t cachedxstep[MAXVIDHEIGHT];
|
|
|
|
extern fixed_t cachedystep[MAXVIDHEIGHT];
|
|
|
|
extern fixed_t basexscale, baseyscale;
|
|
|
|
|
|
|
|
extern fixed_t *yslope;
|
2018-12-14 17:08:25 +00:00
|
|
|
extern lighttable_t **planezlight;
|
2014-03-15 16:59:03 +00:00
|
|
|
|
2018-11-08 16:26:55 +00:00
|
|
|
void R_InitPlanes(void);
|
2014-11-12 00:55:07 +00:00
|
|
|
void R_PortalStoreClipValues(INT32 start, INT32 end, INT16 *ceil, INT16 *floor, fixed_t *scale);
|
|
|
|
void R_PortalRestoreClipValues(INT32 start, INT32 end, INT16 *ceil, INT16 *floor, fixed_t *scale);
|
2014-03-15 16:59:03 +00:00
|
|
|
void R_ClearPlanes(void);
|
|
|
|
|
|
|
|
void R_MapPlane(INT32 y, INT32 x1, INT32 x2);
|
|
|
|
void R_MakeSpans(INT32 x, INT32 t1, INT32 b1, INT32 t2, INT32 b2);
|
|
|
|
void R_DrawPlanes(void);
|
|
|
|
visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel, fixed_t xoff, fixed_t yoff, angle_t plangle,
|
2015-04-20 07:10:14 +00:00
|
|
|
extracolormap_t *planecolormap, ffloor_t *ffloor
|
2016-10-09 20:48:25 +00:00
|
|
|
#ifdef POLYOBJECTS_PLANES
|
|
|
|
, polyobj_t *polyobj
|
|
|
|
#endif
|
2015-04-20 07:10:14 +00:00
|
|
|
#ifdef ESLOPE
|
|
|
|
, pslope_t *slope
|
|
|
|
#endif
|
|
|
|
);
|
2014-03-15 16:59:03 +00:00
|
|
|
visplane_t *R_CheckPlane(visplane_t *pl, INT32 start, INT32 stop);
|
|
|
|
void R_ExpandPlane(visplane_t *pl, INT32 start, INT32 stop);
|
|
|
|
void R_PlaneBounds(visplane_t *plane);
|
|
|
|
|
|
|
|
// Draws a single visplane.
|
|
|
|
void R_DrawSinglePlane(visplane_t *pl);
|
|
|
|
|
|
|
|
typedef struct planemgr_s
|
|
|
|
{
|
|
|
|
visplane_t *plane;
|
|
|
|
fixed_t height;
|
|
|
|
fixed_t f_pos; // F for Front sector
|
|
|
|
fixed_t b_pos; // B for Back sector
|
|
|
|
fixed_t f_frac, f_step;
|
|
|
|
fixed_t b_frac, b_step;
|
|
|
|
INT16 f_clip[MAXVIDWIDTH];
|
|
|
|
INT16 c_clip[MAXVIDWIDTH];
|
|
|
|
|
2015-05-17 03:32:12 +00:00
|
|
|
#ifdef ESLOPE
|
|
|
|
// For slope rendering; the height at the other end
|
|
|
|
fixed_t f_pos_slope;
|
|
|
|
fixed_t b_pos_slope;
|
|
|
|
|
|
|
|
struct pslope_s *slope;
|
|
|
|
#endif
|
|
|
|
|
2014-03-15 16:59:03 +00:00
|
|
|
struct ffloor_s *ffloor;
|
|
|
|
#ifdef POLYOBJECTS_PLANES
|
|
|
|
polyobj_t *polyobj;
|
|
|
|
#endif
|
2018-12-14 17:08:25 +00:00
|
|
|
} visffloor_t;
|
2014-03-15 16:59:03 +00:00
|
|
|
|
2018-12-14 17:08:25 +00:00
|
|
|
extern visffloor_t ffloor[MAXFFLOORS];
|
2014-03-15 16:59:03 +00:00
|
|
|
extern INT32 numffloors;
|
|
|
|
#endif
|