/
p_xgsec.h
203 lines (173 loc) · 7.93 KB
/
p_xgsec.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
/**\file
*\section License
* License: GPL + jHeretic/jHexen Exception
* Online License Link: http://www.gnu.org/licenses/gpl.html
*
*\author Copyright © 2003-2008 Jaakko Keränen <jaakko.keranen@iki.fi>
*\author Copyright © 2006-2008 Daniel Swanson <danij@dengine.net>
*
* 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., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301 USA
*
* In addition, as a special exception, we, the authors of deng
* give permission to link the code of our release of deng with
* the libjhexen and/or the libjheretic libraries (or with modified
* versions of it that use the same license as the libjhexen or
* libjheretic libraries), and distribute the linked executables.
* You must obey the GNU General Public License in all respects for
* all of the code used other than “libjhexen or libjheretic”. If
* you modify this file, you may extend this exception to your
* version of the file, but you are not obligated to do so. If you
* do not wish to do so, delete this exception statement from your version.
*/
/**
* p_xgsec.c: Extended Generalized Sector Types.
*/
#ifndef __XG_SECTORTYPE_H__
#define __XG_SECTORTYPE_H__
#include "g_common.h"
// Sector chain event types.
enum {
XSCE_FLOOR,
XSCE_CEILING,
XSCE_INSIDE,
XSCE_TICKER,
XSCE_NUM_CHAINS,
XSCE_FUNCTION
};
// Sector Type flags.
#define STF_GRAVITY 0x00000001 // Use custom gravity gravity.
#define STF_FRICTION 0x00000002 // Use custom friction.
#define STF_CRUSH 0x00000004
#define STF_PLAYER_WIND 0x00000008 // Wind affects players.
#define STF_OTHER_WIND 0x00000010
#define STF_MONSTER_WIND 0x00000020
#define STF_MISSILE_WIND 0x00000040
#define STF_ANY_WIND 0x00000018 // Player + nonplayer.
#define STF_ACT_TAG_MATERIALMOVE 0x00000080 // Materialmove from act tagged line.
#define STF_ACT_TAG_WIND 0x00000100
#define STF_FLOOR_WIND 0x00000200 // Wind only when touching the floor.
#define STF_CEILING_WIND 0x00000400
// Sector Chain Event flags.
#define SCEF_PLAYER_A 0x00000001 // Activate for players.
#define SCEF_OTHER_A 0x00000002 // Act. for non-players.
#define SCEF_MONSTER_A 0x00000004 // Countkills.
#define SCEF_MISSILE_A 0x00000008 // Missiles.
#define SCEF_ANY_A 0x00000010 // All mobjs.
#define SCEF_TICKER_A 0x00000020 // Activate by ticker.
#define SCEF_PLAYER_D 0x00000040 // Deactivate for players.
#define SCEF_OTHER_D 0x00000080 // Deact. for non-players.
#define SCEF_MONSTER_D 0x00000100 // Countkills.
#define SCEF_MISSILE_D 0x00000200 // Missiles.
#define SCEF_ANY_D 0x00000400 // All mobjs.
#define SCEF_TICKER_D 0x00000800 // Deactivate by ticker.
// Plane mover flags.
#define PMF_CRUSH 0x1 // Crush things inside.
// (De)activate origin if move is blocked (when not crushing) and
// destroy mover. Normally the mover waits until it can move again.
#define PMF_ACTIVATE_ON_ABORT 0x2
#define PMF_DEACTIVATE_ON_ABORT 0x4
// (De)activate origin when move is done.
#define PMF_ACTIVATE_WHEN_DONE 0x8
#define PMF_DEACTIVATE_WHEN_DONE 0x10
#define PMF_OTHER_FOLLOWS 0x20 // Other plane follows.
#define PMF_WAIT 0x40 // Wait until timer counts to 0.
#define PMF_SET_ORIGINAL 0x80 // Set origfloor/ceil.
// Only play sound for one sector.
#define PMF_ONE_SOUND_ONLY 0x100
typedef struct function_s {
struct function_s* link; // Linked to another func?
char* func;
int flags;
int pos;
int repeat;
int timer, maxTimer;
int minInterval, maxInterval;
float scale, offset;
float value, oldValue;
} function_t;
enum {
XGSP_FLOOR,
XGSP_CEILING,
XGSP_RED = 0,
XGSP_GREEN,
XGSP_BLUE
};
typedef struct {
thinker_t thinker;
sector_t* sector;
} xsthinker_t;
typedef struct {
boolean disabled;
function_t rgb[3]; // Don't move the functions around in the struct.
function_t plane[2];
function_t light;
sectortype_t info;
int timer;
int chainTimer[DDLT_MAX_CHAINS];
} xgsector_t;
typedef struct {
thinker_t thinker;
struct sector_s* sector;
boolean ceiling; // True if operates on the ceiling.
int flags;
struct linedef_s* origin;
float destination;
float speed; // Signed.
float crushSpeed; // Signed (speed to use when crushing).
materialnum_t setMaterial; // Set material when move done.
int setSectorType; // Sector type to set when move done
// (-1 if no change).
int startSound; // Played after waiting.
int endSound; // Play when move done.
int moveSound; // Sound to play while moving.
int minInterval, maxInterval; // Sound playing intervals.
int timer; // Counts down to zero.
} xgplanemover_t;
void XS_Init(void);
void XS_Update(void);
void XS_Thinker(xsthinker_t* xs);
float XS_Gravity(struct sector_s *sector);
float XS_Friction(struct sector_s *sector);
float XS_ThrustMul(struct sector_s *sector);
void XS_InitMovePlane(struct linedef_s *line);
int C_DECL XSTrav_MovePlane(struct sector_s *sector, boolean ceiling,
void *context, void *context2, struct mobj_s *activator);
int C_DECL XSTrav_SectorType(struct sector_s *sec, boolean ceiling,
void *context, void *context2, struct mobj_s *activator);
int C_DECL XSTrav_SectorLight(struct sector_s *sector, boolean ceiling,
void *context, void *context2, struct mobj_s *activator);
int C_DECL XSTrav_PlaneMaterial(struct sector_s *sec, boolean ceiling,
void *context, void *context2, struct mobj_s *activator);
void XS_InitStairBuilder(struct linedef_s *line);
int C_DECL XSTrav_BuildStairs(struct sector_s *sector, boolean ceiling,
void *context, void *context2, struct mobj_s *activator);
int C_DECL XSTrav_SectorSound(struct sector_s *sec, boolean ceiling,
void *context, void *context2, struct mobj_s *activator);
int C_DECL XSTrav_MimicSector(struct sector_s *sector, boolean ceiling,
void *context, void *context2, struct mobj_s *activator);
int C_DECL XSTrav_Teleport(struct sector_s *sector, boolean ceiling,
void *context, void *context2, struct mobj_s *activator);
void XS_SetSectorType(struct sector_s *sec, int special);
void XS_ChangePlaneMaterial(struct sector_s *sector, boolean ceiling,
materialnum_t mat, float *rgb);
xgplanemover_t *XS_GetPlaneMover(struct sector_s *sector, boolean ceiling);
void XS_PlaneMover(xgplanemover_t *mover); // A thinker for plane movers.
void SV_WriteXGSector(struct sector_s *sec);
void SV_ReadXGSector(struct sector_s *sec);
void SV_WriteXGPlaneMover(thinker_t *th);
int SV_ReadXGPlaneMover(xgplanemover_t* mov);
DEFCC(CCmdMovePlane);
#endif