-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathp_spec.h
314 lines (222 loc) · 6.4 KB
/
p_spec.h
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
/* Emacs style mode select -*- C++ -*-
*-----------------------------------------------------------------------------
*
*
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
* based on BOOM, a modified and improved DOOM engine
* Copyright (C) 1999 by
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
* Copyright (C) 1999-2000 by
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
* Copyright 2005, 2006 by
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
* Copyright 2023, 2024 by
* Frenkel Smeijers
*
* 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 2
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* DESCRIPTION: definitions, declarations and prototypes for specials
*
*-----------------------------------------------------------------------------*/
#ifndef __P_SPEC__
#define __P_SPEC__
#include "r_defs.h"
#include "d_player.h"
// p_floor
#define FLOORSPEED FRACUNIT
// p_ceilng
#define CEILSPEED FRACUNIT
// p_doors
#define VDOORSPEED (FRACUNIT*2)
#define VDOORWAIT 150
// p_plats
#define PLATWAIT 3
#define PLATSPEED FRACUNIT
// p_switch
// 4 players, 4 buttons each at once, max.
// killough 2/14/98: redefine in terms of MAXPLAYERS
#define MAXBUTTONS (MAXPLAYERS*4)
// p_lights
#define GLOWSPEED 8
#define STROBEBRIGHT 5
#define FASTDARK 15
#define SLOWDARK 35
//////////////////////////////////////////////////////////////////
//
// enums for classes of linedef triggers
//
//////////////////////////////////////////////////////////////////
// p_plats
typedef enum
{
up,
down,
waiting,
} plat_e;
typedef enum
{
downWaitUpStay,
raiseToNearestAndChange,
} plattype_e;
// p_doors
typedef enum
{
dnormal,
close30ThenOpen,
dopen,
} vldoor_e;
// p_floor
typedef enum
{
// lower floor to highest surrounding floor
lowerFloor,
// lower floor to lowest surrounding floor
lowerFloorToLowest,
// lower floor to highest surrounding floor VERY FAST
turboLower,
// raise floor to lowest surrounding CEILING
raiseFloor,
// raise floor to next highest surrounding floor
raiseFloorToNearest,
donutRaise,
buildStair,
} floor_e;
//////////////////////////////////////////////////////////////////
//
// general enums
//
//////////////////////////////////////////////////////////////////
// texture type enum
typedef enum
{
top,
middle,
bottom
} bwhere_e;
// crush check returns
typedef enum
{
ok,
crushed,
pastdest
} result_e;
//////////////////////////////////////////////////////////////////
//
// linedef and sector special data types
//
//////////////////////////////////////////////////////////////////
// p_switch
typedef struct
{
const line_t __far* line;
bwhere_e where;
int16_t btexture;
int16_t btimer;
degenmobj_t __far* soundorg;
} button_t;
// p_plats
typedef struct
{
thinker_t thinker;
sector_t __far* sector;
fixed_t speed;
fixed_t low;
fixed_t high;
int16_t wait;
int16_t count;
plat_e status;
int16_t tag;
plattype_e type;
struct platlist __far* list;
} plat_t;
// p_ceilng
typedef struct
{
thinker_t thinker;
vldoor_e type;
sector_t __far* sector;
fixed_t topheight;
fixed_t speed;
// 1 = up, 0 = waiting at top, -1 = down
int16_t direction;
// tics to wait at the top
int16_t topwait;
// (keep in case a door going down is reset)
// when it reaches 0, start going down
int16_t topcountdown;
//jff 1/31/98 keep track of line door is triggered by
const line_t __far* line;
/* killough 10/98: sector tag for gradual lighting effects */
int16_t lighttag;
} vldoor_t;
////////////////////////////////////////////////////////////////
//
// Linedef and sector special utility function prototypes
//
////////////////////////////////////////////////////////////////
fixed_t P_FindLowestFloorSurrounding(sector_t __far* sec);
fixed_t P_FindHighestFloorSurrounding(sector_t __far* sec);
fixed_t P_FindNextHighestFloor(sector_t __far* sec);
fixed_t P_FindLowestCeilingSurrounding(sector_t __far* sec);
int16_t P_FindSectorFromLineTag(const line_t __far* line, int16_t start);
sector_t __far* getNextSector(const line_t __far* line, sector_t __far* sec);
boolean P_CheckTag(const line_t __far* line);
////////////////////////////////////////////////////////////////
//
// Linedef and sector special action function prototypes
//
////////////////////////////////////////////////////////////////
// p_plats
void T_PlatRaise(plat_t __far* plat);
// p_doors
void T_VerticalDoor(vldoor_t __far* door);
// p_floor
result_e T_MovePlaneFloor (sector_t __far* sector, fixed_t speed, fixed_t dest, int16_t direction);
result_e T_MovePlaneCeiling(sector_t __far* sector, fixed_t speed, fixed_t dest, int16_t direction);
////////////////////////////////////////////////////////////////
//
// Linedef and sector special handler prototypes
//
////////////////////////////////////////////////////////////////
// p_floor
boolean EV_DoFloor(const line_t __far* line, floor_e floortype);
// p_doors
boolean EV_DoDoor(const line_t __far* line, vldoor_e type);
// p_plats
boolean EV_DoPlat(const line_t __far* line, plattype_e type);
////////////////////////////////////////////////////////////////
//
// Linedef and sector special thinker spawning
//
////////////////////////////////////////////////////////////////
// at game start
void P_InitSwitchList
( void );
// at map load
void P_SpawnSpecials
( void );
// every tic
void P_UpdateSpecials(void);
// when needed
boolean P_UseSpecialLine(mobj_t __far* thing, line_t __far* line);
// p_lights
void P_SpawnLightFlash(sector_t __far* sector);
void P_SpawnStrobeFlash(sector_t __far* sector, int16_t fastOrSlow, boolean inSync);
void P_SpawnGlowingLight(sector_t __far* sector);
// p_plats
void P_RemoveAllActivePlats
( void ); // killough
#endif