Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | pmbaty | 1 | /* |
2 | * Portions of this file are copyright Rebirth contributors and licensed as |
||
3 | * described in COPYING.txt. |
||
4 | * Portions of this file are copyright Parallax Software and licensed |
||
5 | * according to the Parallax license below. |
||
6 | * See COPYING.txt for license details. |
||
7 | |||
8 | THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX |
||
9 | SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO |
||
10 | END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A |
||
11 | ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS |
||
12 | IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS |
||
13 | SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE |
||
14 | FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE |
||
15 | CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS |
||
16 | AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. |
||
17 | COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. |
||
18 | */ |
||
19 | |||
20 | /* |
||
21 | * |
||
22 | * Header for wall.c |
||
23 | * |
||
24 | */ |
||
25 | |||
26 | #pragma once |
||
27 | |||
28 | #ifdef __cplusplus |
||
29 | #include "fwd-segment.h" |
||
30 | #include "fwd-wall.h" |
||
31 | #include "fwd-object.h" |
||
32 | #include "pack.h" |
||
33 | #include "switch.h" |
||
34 | |||
35 | namespace dcx { |
||
36 | |||
37 | #if defined(DXX_BUILD_DESCENT_I) || defined(DXX_BUILD_DESCENT_II) |
||
38 | struct WALL_IS_DOORWAY_mask_t |
||
39 | { |
||
40 | unsigned value; |
||
41 | template <unsigned F> |
||
42 | constexpr WALL_IS_DOORWAY_mask_t(WALL_IS_DOORWAY_FLAG<F>) : |
||
43 | value(F) |
||
44 | { |
||
45 | } |
||
46 | }; |
||
47 | |||
48 | struct WALL_IS_DOORWAY_result_t |
||
49 | { |
||
50 | unsigned value; |
||
51 | template <unsigned F> |
||
52 | constexpr WALL_IS_DOORWAY_result_t(WALL_IS_DOORWAY_sresult_t<F>) : |
||
53 | value(F) |
||
54 | { |
||
55 | } |
||
56 | template <unsigned F> |
||
57 | unsigned operator&(WALL_IS_DOORWAY_FLAG<F>) const |
||
58 | { |
||
59 | return value & F; |
||
60 | } |
||
61 | template <unsigned F> |
||
62 | WALL_IS_DOORWAY_result_t operator|=(WALL_IS_DOORWAY_FLAG<F>) |
||
63 | { |
||
64 | value |= F; |
||
65 | return *this; |
||
66 | } |
||
67 | template <unsigned F> |
||
68 | bool operator==(WALL_IS_DOORWAY_sresult_t<F>) const |
||
69 | { |
||
70 | return value == F; |
||
71 | } |
||
72 | bool operator&(WALL_IS_DOORWAY_mask_t m) const |
||
73 | { |
||
74 | return value & m.value; |
||
75 | } |
||
76 | bool operator==(WALL_IS_DOORWAY_result_t) const = delete; |
||
77 | template <typename T> |
||
78 | bool operator!=(const T &t) const |
||
79 | { |
||
80 | return !(*this == t); |
||
81 | } |
||
82 | }; |
||
83 | |||
84 | struct stuckobj : public prohibit_void_ptr<stuckobj> |
||
85 | { |
||
86 | objnum_t objnum = object_none; |
||
87 | wallnum_t wallnum = wall_none; |
||
88 | }; |
||
89 | #endif |
||
90 | |||
91 | //Start old wall structures |
||
92 | |||
93 | struct v16_wall : public prohibit_void_ptr<v16_wall> |
||
94 | { |
||
95 | sbyte type; // What kind of special wall. |
||
96 | sbyte flags; // Flags for the wall. |
||
97 | uint8_t trigger; // Which trigger is associated with the wall. |
||
98 | fix hps; // "Hit points" of the wall. |
||
99 | sbyte clip_num; // Which animation associated with the wall. |
||
100 | sbyte keys; |
||
101 | }; |
||
102 | |||
103 | struct v19_wall : public prohibit_void_ptr<v19_wall> |
||
104 | { |
||
105 | segnum_t segnum; |
||
106 | sbyte type; // What kind of special wall. |
||
107 | sbyte flags; // Flags for the wall. |
||
108 | int sidenum; // Seg & side for this wall |
||
109 | fix hps; // "Hit points" of the wall. |
||
110 | uint8_t trigger; // Which trigger is associated with the wall. |
||
111 | sbyte clip_num; // Which animation associated with the wall. |
||
112 | sbyte keys; |
||
113 | int linked_wall; // number of linked wall |
||
114 | }; |
||
115 | |||
116 | #ifdef dsx |
||
117 | class d_level_unique_stuck_object_state |
||
118 | { |
||
119 | protected: |
||
120 | unsigned Num_stuck_objects = 0; |
||
121 | std::array<stuckobj, 32> Stuck_objects; |
||
122 | public: |
||
123 | void init_stuck_objects(); |
||
124 | }; |
||
125 | #endif |
||
126 | |||
127 | } |
||
128 | |||
129 | //End old wall structures |
||
130 | |||
131 | #ifdef dsx |
||
132 | namespace dsx { |
||
133 | |||
134 | /* No shared state is possible for this structure, but include the |
||
135 | * `unique` qualifier to document its status. |
||
136 | */ |
||
137 | class d_level_unique_stuck_object_state : public ::dcx::d_level_unique_stuck_object_state |
||
138 | { |
||
139 | public: |
||
140 | void add_stuck_object(fvcwallptr &, vmobjptridx_t objp, const shared_segment &segp, unsigned sidenum); |
||
141 | void remove_stuck_object(vcobjidx_t); |
||
142 | void kill_stuck_objects(fvmobjptr &, vcwallidx_t wallnum); |
||
143 | }; |
||
144 | |||
145 | extern d_level_unique_stuck_object_state LevelUniqueStuckObjectState; |
||
146 | |||
147 | struct wall : public prohibit_void_ptr<wall> |
||
148 | { |
||
149 | segnum_t segnum; |
||
150 | uint8_t sidenum; // Seg & side for this wall |
||
151 | uint8_t type; // What kind of special wall. |
||
152 | fix hps; // "Hit points" of the wall. |
||
153 | uint16_t explode_time_elapsed; |
||
154 | wallnum_t linked_wall; // number of linked wall |
||
155 | ubyte flags; // Flags for the wall. |
||
156 | ubyte state; // Opening, closing, etc. |
||
157 | uint8_t trigger; // Which trigger is associated with the wall. |
||
158 | sbyte clip_num; // Which animation associated with the wall. |
||
159 | ubyte keys; // which keys are required |
||
160 | #if defined(DXX_BUILD_DESCENT_II) |
||
161 | sbyte controlling_trigger;// which trigger causes something to happen here. Not like "trigger" above, which is the trigger on this wall. |
||
162 | // Note: This gets stuffed at load time in gamemine.c. Don't try to use it in the editor. You will be sorry! |
||
163 | sbyte cloak_value; // if this wall is cloaked, the fade value |
||
164 | #endif |
||
165 | }; |
||
166 | |||
167 | } |
||
168 | |||
169 | namespace dcx { |
||
170 | |||
171 | struct active_door : public prohibit_void_ptr<active_door> |
||
172 | { |
||
173 | unsigned n_parts; // for linked walls |
||
174 | std::array<wallnum_t, 2> front_wallnum; // front wall numbers for this door |
||
175 | std::array<wallnum_t, 2> back_wallnum; // back wall numbers for this door |
||
176 | fix time; // how long been opening, closing, waiting |
||
177 | }; |
||
178 | |||
179 | struct d_level_unique_active_door_state |
||
180 | { |
||
181 | active_door_array ActiveDoors; |
||
182 | }; |
||
183 | |||
184 | } |
||
185 | |||
186 | namespace dsx { |
||
187 | #if defined(DXX_BUILD_DESCENT_II) |
||
188 | struct cloaking_wall : public prohibit_void_ptr<cloaking_wall> |
||
189 | { |
||
190 | wallnum_t front_wallnum; // front wall numbers for this door |
||
191 | wallnum_t back_wallnum; // back wall numbers for this door |
||
192 | std::array<fix, 4> front_ls; // front wall saved light values |
||
193 | std::array<fix, 4> back_ls; // back wall saved light values |
||
194 | fix time; // how long been cloaking or decloaking |
||
195 | }; |
||
196 | |||
197 | struct d_level_unique_cloaking_wall_state |
||
198 | { |
||
199 | cloaking_wall_array CloakingWalls; |
||
200 | }; |
||
201 | #endif |
||
202 | |||
203 | struct d_level_unique_wall_state |
||
204 | { |
||
205 | wall_array Walls; |
||
206 | }; |
||
207 | |||
208 | struct d_level_unique_wall_subsystem_state : |
||
209 | d_level_unique_active_door_state, |
||
210 | d_level_unique_trigger_state, |
||
211 | d_level_unique_wall_state |
||
212 | #if defined(DXX_BUILD_DESCENT_II) |
||
213 | , d_level_unique_cloaking_wall_state |
||
214 | #endif |
||
215 | { |
||
216 | }; |
||
217 | |||
218 | extern d_level_unique_wall_subsystem_state LevelUniqueWallSubsystemState; |
||
219 | |||
220 | struct wclip : public prohibit_void_ptr<wclip> |
||
221 | { |
||
222 | fix play_time; |
||
223 | uint16_t num_frames; |
||
224 | union { |
||
225 | std::array<int16_t, MAX_CLIP_FRAMES> frames; |
||
226 | std::array<int16_t, MAX_CLIP_FRAMES_D1> d1_frames; |
||
227 | }; |
||
228 | short open_sound; |
||
229 | short close_sound; |
||
230 | short flags; |
||
231 | std::array<char, 13> filename; |
||
232 | }; |
||
233 | |||
234 | constexpr std::integral_constant<uint16_t, 0xffff> wclip_frames_none{}; |
||
235 | |||
236 | } |
||
237 | #endif |
||
238 | #endif |