[go: up one dir, main page]

Menu

[904618]: / src / r_plane.h  Maximize  Restore  History

Download this file

156 lines (121 with data), 4.9 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
// -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*-
// ----------------------------------------------------------------------------
// :oCCCCOCoc.
// .cCO8OOOOOOOOO8Oo:
// .oOO8OOOOOOOOOOOOOOOCc
// cO8888: .:oOOOOC. TM
// :888888: :CCCc .oOOOOC. ### ### #########
// C888888: .ooo: .C######## ##### ##### ###### ###### ##########
// O888888: .oO### ### ##### ##### ######## ######## #### ###
// C888888: :8O. .C########## ### #### ### ## ## ## ## #### ###
// :8@@@@8: :888c o### ### #### ### ######## ######## ##########
// :8@@@@C C@@@@ oo######## ### ## ### ###### ###### #########
// cO@@@@@@@@@@@@@@@@@Oc0
// :oO8@@@@@@@@@@Oo.
// .oCOOOOOCc. http://remood.org/
// ----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 2008-2013 GhostlyDeath <ghostlydeath@remood.org>
// <ghostlydeath@gmail.com>
// ----------------------------------------------------------------------------
// This program 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.
//
// This program 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.
// ----------------------------------------------------------------------------
// DESCRIPTION: Refresh, visplane stuff (floor, ceilings).
#ifndef __R_PLANE__
#define __R_PLANE__
#include "doomtype.h"
#include "r_defs.h"
/* Define player_t */
#if !defined(__REMOOD_PLAYERT_DEFINED)
typedef struct player_s player_t;
#define __REMOOD_PLAYERT_DEFINED
#endif
//
// Now what is a visplane, anyway?
// Simple : kinda floor/ceiling polygon optimised for Doom rendering.
// 4124 bytes!
//
typedef struct visplane_s
{
struct visplane_s* next; //SoM: 3/17/2000
fixed_t height;
fixed_t viewz;
angle_t viewangle;
int picnum;
int lightlevel;
int minx;
int maxx;
sector_t* Sector; // Sector to draw
int32_t SkyTexture; // Sky Texture
fixed_t SkyTextureMid; // Sky Texture Mid
//SoM: 4/3/2000: Colormaps per sector!
extracolormap_t* extra_colormap;
// leave pads for [minx-1]/[maxx+1]
//faB: words sucks .. should get rid of that.. but eats memory
//added:08-02-98: THIS IS UNSIGNED! VERY IMPORTANT!!
uint16_t* top;
uint16_t* bottom;
int high, low; // SoM: R_PlaneBounds should set these.
fixed_t xoffs, yoffs; // SoM: 3/6/2000: Srolling flats.
// SoM: frontscale should be stored in the first seg of the subsector
// where the planes themselves are stored. I'm doing this now because
// the old way caused trouble with the drawseg array was re-sized.
int scaleseg;
struct ffloor_s* ffloor;
} visplane_t;
#define MAXVISPLANES 128
extern visplane_t** visplane_ptr;
extern visplane_t* floorplane;
extern visplane_t* ceilingplane;
// Visplane related.
extern short* lastopening;
typedef void (*planefunction_t) (int top, int bottom);
extern planefunction_t floorfunc;
extern planefunction_t ceilingfunc_t;
extern short* floorclip;
extern short* ceilingclip;
extern short* waterclip; //added:18-02-98:WATER!
extern fixed_t* frontscale;
extern fixed_t* yslopetab;
extern fixed_t* yslope;
extern fixed_t* distscale;
void R_InitPlanes(void);
void R_ClearPlanes(player_t* player);
void R_MapPlane(int y, int x1, int x2);
void R_MakeSpans(int x, int t1, int b1, int t2, int b2);
void R_DrawPlanes(void);
visplane_t* R_FindPlane(fixed_t height, int picnum, int lightlevel, fixed_t xoff, fixed_t yoff, extracolormap_t* planecolormap, ffloor_t* ffloor, sector_t* const a_Sector);
visplane_t* R_CheckPlane(visplane_t* pl, int start, int stop);
void R_ExpandPlane(visplane_t* pl, int start, int stop);
// SoM: Draws a single visplane. If !handlesource, it won't allocate or
// remove ds_source.
void R_DrawSinglePlane(visplane_t* pl, bool_t handlesource);
void R_PlaneBounds(visplane_t* plane);
typedef struct planemgr_s
{
visplane_t* plane;
fixed_t height;
bool_t mark;
fixed_t f_pos; // `F' for `Front sector'.
fixed_t b_pos; // `B' for `Back sector'
fixed_t f_frac;
fixed_t f_step;
fixed_t b_frac;
fixed_t b_step;
short* f_clip;
short* c_clip;
struct ffloor_s* ffloor;
} planemgr_t;
extern planemgr_t ffloor[MAXFFLOORS];
extern int numffloors;
extern int* spanstart;
#endif