1 #ifndef __SECTORE_H
2 #define __SECTORE_H
3 
4 
5 #define CenterSpot(sec) (vertex_t*)&(sec)->soundorg[0]
6 
7 // 3D floor flags. Most are the same as in Legacy but I added some for EDGE's and Vavoom's features as well.
8 typedef enum
9 {
10   FF_EXISTS            = 0x1,    //MAKE SURE IT'S VALID
11   FF_SOLID             = 0x2,    //Does it clip things?
12   FF_RENDERSIDES       = 0x4,    //Render the sides?
13   FF_RENDERPLANES      = 0x8,    //Render the floor/ceiling?
14   FF_RENDERALL         = 0xC,    //Render everything?
15   FF_SWIMMABLE         = 0x10,   //Can we swim?
16   FF_NOSHADE           = 0x20,   //Does it mess with the lighting?
17   FF_BOTHPLANES        = 0x200,  //Render both planes all the time?
18   FF_TRANSLUCENT       = 0x800,  //See through!
19   FF_FOG               = 0x1000, //Fog "brush"?
20   FF_INVERTPLANES      = 0x2000, //Reverse the plane visibility rules?
21   FF_ALLSIDES          = 0x4000, //Render inside and outside sides?
22   FF_INVERTSIDES       = 0x8000, //Only render inside sides?
23   FF_DOUBLESHADOW      = 0x10000,//Make two lightlist entries to reset light?
24   FF_UPPERTEXTURE	   = 0x20000,
25   FF_LOWERTEXTURE      = 0x40000,
26   FF_THINFLOOR		   = 0x80000,	// EDGE
27   FF_SCROLLY           = 0x100000,  // EDGE - not yet implemented!!!
28   FF_FIX			   = 0x200000,  // use floor of model sector as floor and floor of real sector as ceiling
29   FF_INVERTSECTOR	   = 0x400000,	// swap meaning of sector planes
30   FF_DYNAMIC		   = 0x800000,	// created by partitioning another 3D-floor due to overlap
31   FF_CLIPPED		   = 0x1000000,	// split into several dynamic ffloors
32   FF_SEETHROUGH        = 0x2000000,
33   FF_SHOOTTHROUGH      = 0x4000000,
34   FF_FADEWALLS         = 0x8000000,	// Applies real fog to walls and doesn't blend the view
35   FF_ADDITIVETRANS	   = 0x10000000, // Render this floor with additive translucency
36   FF_FLOOD			   = 0x20000000, // extends towards the next lowest flooding or solid 3D floor or the bottom of the sector
37   FF_THISINSIDE		   = 0x40000000, // hack for software 3D with FF_BOTHPLANES
38   FF_RESET			   = 0x80000000, // light effect is completely reset, once interrupted
39 } ffloortype_e;
40 
41 // This is for the purpose of Sector_SetContents:
42 #ifdef _MSC_VER
43 enum : unsigned int // MSVC is apparently the only compiler that supports this syntax
44 #else
45 enum
46 #endif
47 {
48 	VC_EMPTY = 0, // Here's the original values of the color shifts in Vavoom, and in ARGB:
49 	VC_WATER	 = 0x80825032,	// 130, 80, 50, 128		-> 80.82.50.32 (was 0x101080)
50 	VC_LAVA		 = 0x96FF5000,	// 255, 80, 0, 150		-> 96.FF.50.00 (was 0xf0f010)
51 	VC_NUKAGE	 = 0x9632FF32,	// 50, 255, 50, 150		-> 96.32.FF.32 (was 0x108010)
52 	VC_SLIME	 = 0x96001905,	// 0, 25, 5, 150		-> 96.00.19.05 (was 0x287020)
53 	VC_HELLSLIME = 0x96FF5000,	// 255, 80, 0, 150		-> 96.FF.50.00 (wasn't covered)
54 	VC_BLOOD	 = 0x96A00A0A,	// 160, 16, 16, 150		-> 96.A0.0A.0A (was 0x801010)
55 	VC_SLUDGE	 = 0x9680A080,	// 128, 160, 128, 150	-> 96.80.A0.80 (wasn't covered)
56 	VC_HAZARD	 = 0x8080A080,	// 128, 160, 128, 128	-> 80.80.A0.80 (wasn't covered)
57 	VC_BOOMWATER = 0x80004FA5,	// Boom WATERMAP:		-> 80.00.4F.A5 (wasn't covered)
58 	VC_ALPHAMASK = 0xFF000000,
59 	VC_COLORMASK = 0x00FFFFFF,
60 };
61 
62 
63 struct secplane_t;
64 struct FDynamicColormap;
65 
66 
67 struct F3DFloor
68 {
69 	struct planeref
70 	{
71 		secplane_t *	plane;
72 		const FTextureID *	texture;
73 		const fixed_t *		texheight;
74 		sector_t *		model;
75 		int				isceiling;
76 		int				vindex;
77 		bool			copied;
78 
copyPlaneF3DFloor::planeref79 		void copyPlane(planeref * other)
80 		{
81 			*this = *other;
82 			copied = true;
83 		}
84 	};
85 
86 	planeref			bottom;
87 	planeref			top;
88 
89 	short				*toplightlevel;
90 
91 	fixed_t				delta;
92 
93 	unsigned int		flags;
94 	line_t*				master;
95 
96 	sector_t *			model;
97 	sector_t *			target;
98 
99 	int					lastlight;
100 	int					alpha;
101 
102 	// kg3D - for software
103 	short	*floorclip;
104 	short	*ceilingclip;
105 	int	validcount;
106 
107 	FDynamicColormap *GetColormap();
108 	void UpdateColormap(FDynamicColormap *&map);
109 	PalEntry GetBlend();
110 };
111 
112 
113 
114 struct lightlist_t
115 {
116 	secplane_t				plane;
117 	short *					p_lightlevel;
118 	FDynamicColormap *		extra_colormap;
119 	PalEntry				blend;
120 	int						flags;
121 	F3DFloor*				lightsource;
122 	F3DFloor*				caster;
123 };
124 
125 
126 
127 class player_s;
128 void P_PlayerOnSpecial3DFloor(player_t* player);
129 
130 void P_Get3DFloorAndCeiling(AActor * thing, sector_t * sector, fixed_t * floorz, fixed_t * ceilingz, int * floorpic);
131 bool P_CheckFor3DFloorHit(AActor * mo);
132 bool P_CheckFor3DCeilingHit(AActor * mo);
133 void P_Recalculate3DFloors(sector_t *);
134 void P_RecalculateAttached3DFloors(sector_t * sec);
135 void P_RecalculateLights(sector_t *sector);
136 void P_RecalculateAttachedLights(sector_t *sector);
137 
138 lightlist_t * P_GetPlaneLight(sector_t * , secplane_t * plane, bool underside);
139 void P_Spawn3DFloors( void );
140 
141 struct FLineOpening;
142 
143 void P_LineOpening_XFloors (FLineOpening &open, AActor * thing, const line_t *linedef,
144 							fixed_t x, fixed_t y, fixed_t refx, fixed_t refy, bool restrict);
145 
146 secplane_t P_FindFloorPlane(sector_t * sector, fixed_t x, fixed_t y, fixed_t z);
147 int	P_Find3DFloor(sector_t * sec, fixed_t x, fixed_t y, fixed_t z, bool above, bool floor, fixed_t &cmpz);
P_Find3DFloor(sector_t * sec,const fixedvec3 & pos,bool above,bool floor,fixed_t & cmpz)148 inline int	P_Find3DFloor(sector_t * sec, const fixedvec3 &pos, bool above, bool floor, fixed_t &cmpz)
149 {
150 	return P_Find3DFloor(sec, pos.x, pos.y, pos.z, above, floor, cmpz);
151 }
152 
153 
154 #endif