| 1 | /* |
| 2 | * Descent 3 |
| 3 | * Copyright (C) 2024 Parallax Software |
| 4 | * |
| 5 | * This program is free software: you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation, either version 3 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | |
| 18 | --- HISTORICAL COMMENTS FOLLOW --- |
| 19 | |
| 20 | * $Logfile: /DescentIII/main/room_external.h $ |
| 21 | * $Revision: 21 $ |
| 22 | * $Date: 10/21/99 1:32p $ |
| 23 | * $Author: Jeff $ |
| 24 | * |
| 25 | * Defines and structs for room definitions (for DLL export) |
| 26 | * |
| 27 | * $Log: /DescentIII/main/room_external.h $ |
| 28 | * |
| 29 | * 21 10/21/99 1:32p Jeff |
| 30 | * added checkbox to prevent certain rooms from lighting |
| 31 | * |
| 32 | * 20 4/28/99 1:39p Chris |
| 33 | * Added the ability to block portals |
| 34 | * |
| 35 | * 19 4/26/99 11:11a Chris |
| 36 | * Updated Bnode system |
| 37 | * |
| 38 | * 18 4/18/99 5:39a Chris |
| 39 | * Vastly improved the path node system |
| 40 | * |
| 41 | * 17 4/15/99 5:49p Chris |
| 42 | * Fixed a bug with rendering the BOAPath nodes |
| 43 | * |
| 44 | * 16 4/15/99 12:20p Jason |
| 45 | * made mirrors more robust and able to have multiple mirrored faces in |
| 46 | * the same room (as long as they are all on the same plane) |
| 47 | * |
| 48 | * 15 4/14/99 3:13p Chris |
| 49 | * Beginning to add BoaNode stuff |
| 50 | * |
| 51 | * 14 4/14/99 11:40a Jason |
| 52 | * added secret flag |
| 53 | * |
| 54 | * 13 4/05/99 10:54a Matt |
| 55 | * Added auto-waypoint system |
| 56 | * |
| 57 | * 12 3/31/99 5:14p Matt |
| 58 | * Added shell flag for faces |
| 59 | * |
| 60 | * 11 3/11/99 1:08p Jason |
| 61 | * more fixes for smooth specular lighting |
| 62 | * |
| 63 | * 10 3/01/99 8:10p Matt |
| 64 | * Added flag for manually-set path points |
| 65 | * |
| 66 | * 9 2/21/99 4:35p Chris |
| 67 | * Improving the level goal system... Not done. |
| 68 | * |
| 69 | * 8 2/19/99 4:26p Jason |
| 70 | * more work on Katmai support |
| 71 | * |
| 72 | * 7 2/09/99 9:59a Chris |
| 73 | * Massive BOA update :) Terrain happy now. Vis happy now. Sound happy |
| 74 | * now. |
| 75 | * |
| 76 | * 6 2/03/99 5:49p Matt |
| 77 | * Added room damage system |
| 78 | * |
| 79 | * 5 2/03/99 4:26p Jason |
| 80 | * made multiplayer coop actually work! |
| 81 | * |
| 82 | * 4 2/01/99 4:17p Jason |
| 83 | * more changes for multisafe |
| 84 | * |
| 85 | * 3 1/29/99 12:48p Matt |
| 86 | * Rewrote the doorway system |
| 87 | * |
| 88 | * 2 1/21/99 11:15p Jeff |
| 89 | * pulled out some structs and defines from header files and moved them |
| 90 | * into seperate header files so that multiplayer dlls don't require major |
| 91 | * game headers, just those new headers. Side effect is a shorter build |
| 92 | * time. Also cleaned up some header file #includes that weren't needed. |
| 93 | * This affected polymodel.h, object.h, player.h, vecmat.h, room.h, |
| 94 | * manage.h and multi.h |
| 95 | * |
| 96 | * $NoKeywords: $ |
| 97 | */ |
| 98 | |
| 99 | #ifndef _ROOM_EXTERNAL_H_ |
| 100 | #define _ROOM_EXTERNAL_H_ |
| 101 | |
| 102 | #include "pstypes.h" |
| 103 | #include "vecmat_external.h" |
| 104 | #include "bnode.h" |
| 105 | |
| 106 | #define MAX_FACES_PER_ROOM 3000 // max number of faces per room |
| 107 | #define MAX_VERTS_PER_ROOM 10000 // max vertices per room |
| 108 | #define MAX_VERTS_PER_FACE 64 // max vertices per face |
| 109 | |
| 110 | // Face flags |
| 111 | // NOTE: If you add a flag here, please check the function CopyFaceFlags() |
| 112 | #define FF_LIGHTMAP 0x0001 // Render this face with a lightmap on top |
| 113 | #define FF_VERTEX_ALPHA 0x0002 // This face has vertex alpha blending |
| 114 | #define FF_CORONA 0x0004 // This face has a lighting corona |
| 115 | #define FF_TEXTURE_CHANGED 0x0008 // The texture on this face has changed |
| 116 | #define FF_HAS_TRIGGER 0x0010 // This face has a trigger |
| 117 | #define FF_SPEC_INVISIBLE 0x0020 // This face needs to be not rendered during specularity pass |
| 118 | #define FF_FLOATING_TRIG 0x0040 // This face only exists as a floating trigger |
| 119 | #define FF_DESTROYED 0x0080 // This face has been blown up |
| 120 | #define FF_VOLUMETRIC 0x0100 // This face is a volumetric face |
| 121 | #define FF_TRIANGULATED 0x0200 // ?? |
| 122 | #define FF_VISIBLE 0x0400 // This face is visible this frame (Valid only during render) |
| 123 | #define FF_NOT_SHELL 0x0800 // This face is not part of the room shell |
| 124 | #define FF_TOUCHED 0x1000 // This face has been touched by fvi_QuickDistFaceList |
| 125 | #define FF_GOALFACE 0x2000 // This face is a goal texture face |
| 126 | #define FF_NOT_FACING 0x4000 // This face is not facing us this frame (Valid only during render) |
| 127 | #define FF_SCORCHED 0x8000 // This face has one or more scorch marks |
| 128 | // NOTE: If you add a flag here, please check the function CopyFaceFlags() |
| 129 | |
| 130 | // UVLs for room verts |
| 131 | struct roomUVL { |
| 132 | float u, v; // texture coordinates |
| 133 | float u2, v2; |
| 134 | uint8_t alpha; // alpha for this vertex |
| 135 | }; |
| 136 | |
| 137 | // an n-sided polygon used as part of a room or portal |
| 138 | struct face { |
| 139 | uint16_t flags; // flags for this face (see above) |
| 140 | uint8_t num_verts; // how many vertices in this face |
| 141 | int8_t portal_num; // which portal this face is part of, or -1 if none |
| 142 | |
| 143 | int16_t *face_verts; // index into list of vertices for this face |
| 144 | roomUVL *face_uvls; // index into list of uvls for this face |
| 145 | vector normal; // the surface normal of this face |
| 146 | int16_t tmap; // texture numbers for this face |
| 147 | uint16_t lmi_handle; // the lightmap info number for this face |
| 148 | int16_t special_handle; // the index into the special_faces array |
| 149 | uint8_t renderframe; // what frame this face was last rendered (for lighting) |
| 150 | uint8_t light_multiple; // what multiple to times by |
| 151 | vector min_xyz, max_xyz; // min & max extents of this face (for FVI) |
| 152 | }; |
| 153 | |
| 154 | // Portal flags |
| 155 | #define PF_RENDER_FACES 1 // render the face(s) in the portal |
| 156 | #define PF_RENDERED_FLYTHROUGH 2 // allow flythrough of rendered faces |
| 157 | #define PF_TOO_SMALL_FOR_ROBOT 4 // Too small for a robot to use for path following (like a small window) |
| 158 | #define PF_COMBINED 8 // This portal has been combined with another for rendering purposes |
| 159 | #define PF_CHANGED 16 // Used for multiplayer - this portal has been changed |
| 160 | #define PF_BLOCK 32 |
| 161 | #define PF_BLOCK_REMOVABLE 64 |
| 162 | |
| 163 | // a connection between two rooms |
| 164 | struct portal { |
| 165 | int flags; // flags for this portal |
| 166 | int16_t portal_face; // the face for this portal |
| 167 | int16_t croom; // the room this portal connects to |
| 168 | int16_t cportal; // the portal in croom this portal connects to |
| 169 | int16_t bnode_index; |
| 170 | int combine_master; // For rendering combined portals |
| 171 | vector path_pnt; // Point used by the path system |
| 172 | }; |
| 173 | |
| 174 | // Room flags |
| 175 | #define RF_FUELCEN 1 // room is a refueling center |
| 176 | #define RF_DOOR (1 << 1) // a 3d door is here. |
| 177 | #define RF_EXTERNAL (1 << 2) // this is an external room (i.e. a building) |
| 178 | #define RF_GOAL1 (1 << 3) // this room is goal 1 |
| 179 | #define RF_GOAL2 (1 << 4) // this room is goal 2 |
| 180 | #define RF_TOUCHES_TERRAIN (1 << 5) // this room should recieve lighting from satellites |
| 181 | #define RF_SORTED_INC_Y (1 << 6) // Faces are sorted with increasing y |
| 182 | #define RF_GOAL3 (1 << 7) // this room is goal 3 |
| 183 | #define RF_GOAL4 (1 << 8) // this room is goal 4 |
| 184 | #define RF_FOG (1 << 9) // this room is fogged |
| 185 | #define RF_SPECIAL1 (1 << 10) // This room is a special room |
| 186 | #define RF_SPECIAL2 (1 << 11) // This room is a special room |
| 187 | #define RF_SPECIAL3 (1 << 12) // This room is a special room |
| 188 | #define RF_SPECIAL4 (1 << 13) // This room is a special room |
| 189 | #define RF_SPECIAL5 (1 << 14) // This room is a special room |
| 190 | #define RF_SPECIAL6 (1 << 15) // This room is a special room |
| 191 | #define RF_MIRROR_VISIBLE (1 << 16) // The mirror is this room is visible |
| 192 | #define RF_TRIANGULATE (1 << 17) // All the faces in this room should be drawn with triagulation on |
| 193 | #define RF_STROBE (1 << 18) // This room strobes with pulse lighting |
| 194 | #define RF_FLICKER (1 << 19) // This room flickers with pulse lighting |
| 195 | #define RFM_MINE \ |
| 196 | ((1 << 20) | (1 << 21) | (1 << 22) | (1 << 23) | \ |
| 197 | (1 << 24)) // Mine index of this room (we support up to 32 individual mines without a problem) |
| 198 | #define RF_INFORM_RELINK_TO_LG (1 << 25) // Informs the level goal system on player relinking to this room |
| 199 | #define RF_MANUAL_PATH_PNT (1 << 26) // The room path_pnt has been set manually (i.e. by the designer) |
| 200 | #define RF_WAYPOINT (1 << 27) // This room has a waypoint in it |
| 201 | #define RF_SECRET (1 << 28) // This room is a secret room |
| 202 | #define RF_NO_LIGHT (1 << 29) // This room does not get lit |
| 203 | |
| 204 | #define GOALROOM (RF_GOAL1 | RF_GOAL2 | RF_GOAL3 | RF_GOAL4) |
| 205 | |
| 206 | #define ROOM_NAME_LEN 19 // how long a room name can be (not counting null terminator) |
| 207 | |
| 208 | struct doorway; |
| 209 | |
| 210 | // the basic building-block of a Descent 3 level |
| 211 | struct room { |
| 212 | int flags; // various room flags |
| 213 | |
| 214 | int num_faces; // how many poygons in this room |
| 215 | int num_portals; // how many connections in this room |
| 216 | int num_verts; // how many verts in the room |
| 217 | face *faces; // pointer to list of faces |
| 218 | portal *portals; // pointer to list of portals |
| 219 | vector *verts; // array of vertices for this room |
| 220 | vector4 *verts4; // array of 16byte vertices for this room |
| 221 | |
| 222 | doorway *doorway_data; // pointer to this room's doorway data, or NULL if not a doorway |
| 223 | char *name; // name of this room, or NULL |
| 224 | int objects; // index of first object in this room |
| 225 | vector max_xyz, min_xyz; // for external room visibility checking |
| 226 | |
| 227 | float last_render_time; // Last time we rendered this room |
| 228 | |
| 229 | // Hierarchical bounding boxes for this room |
| 230 | vector bbf_min_xyz; |
| 231 | vector bbf_max_xyz; |
| 232 | int16_t num_bbf_regions; |
| 233 | int16_t pad1; |
| 234 | int16_t **bbf_list; |
| 235 | int16_t *num_bbf; |
| 236 | vector *bbf_list_min_xyz; |
| 237 | vector *bbf_list_max_xyz; |
| 238 | uint8_t *bbf_list_sector; |
| 239 | |
| 240 | bn_list bn_info; |
| 241 | |
| 242 | int16_t wpb_index; // world point buffer index - where this room starts |
| 243 | uint8_t pulse_time; // each room can has a pulse time |
| 244 | uint8_t pulse_offset; // each room has a timer offset for which it pulses |
| 245 | vector wind; // Wind vector for the room |
| 246 | int ambient_sound; // Index of ambient sound pattern for this room, or -1 if none |
| 247 | int16_t vis_effects; // index of first visual effect in this room |
| 248 | int16_t mirror_face; // Index of face that this room is to be mirrored by |
| 249 | uint8_t num_mirror_faces; // Number of faces in this room that have the same texture as the mirror |
| 250 | uint16_t *mirror_faces_list; // the list of faces in this room that have the same texture as the mirror |
| 251 | float damage; // The damage per second applied to players (& maybe others) in room |
| 252 | |
| 253 | vector path_pnt; // Point used by the path system |
| 254 | uint8_t *volume_lights; // Pointer to memory for our volumetric lighting |
| 255 | int16_t volume_width; // The dimensions of our volumetric room |
| 256 | int16_t volume_height; |
| 257 | int16_t volume_depth; |
| 258 | float fog_depth; // How far until fog is totally opaque |
| 259 | float fog_r, fog_g, fog_b; // Fog color |
| 260 | |
| 261 | uint8_t env_reverb; // environmental reverb preset |
| 262 | uint8_t room_change_flags; // For multiplayer, detects what characteristics have to be sent |
| 263 | uint8_t damage_type; // What type of damage this rooms does (for sound) if damage > 0 |
| 264 | uint8_t used; // is this room holding data? |
| 265 | |
| 266 | }; |
| 267 | |
| 268 | #endif |