| 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/door.h $ |
| 21 | * $Revision: 11 $ |
| 22 | * $Date: 6/10/99 1:11p $ |
| 23 | * $Author: Gwar $ |
| 24 | * |
| 25 | * doorway structures and side info. |
| 26 | * |
| 27 | * $Log: /DescentIII/Main/door.h $ |
| 28 | * |
| 29 | * 11 6/10/99 1:11p Gwar |
| 30 | * adding door support for NEWEDITOR |
| 31 | * |
| 32 | * 10 2/25/99 1:26p Sean |
| 33 | * Increased MAX_DOORS from 50 to 60 (MattT on Sean's machine) |
| 34 | * |
| 35 | * 9 2/04/99 2:05p Matt |
| 36 | * Added blastable doors |
| 37 | * |
| 38 | * 8 1/21/99 11:15p Jeff |
| 39 | * pulled out some structs and defines from header files and moved them |
| 40 | * into seperate header files so that multiplayer dlls don't require major |
| 41 | * game headers, just those new headers. Side effect is a shorter build |
| 42 | * time. Also cleaned up some header file #includes that weren't needed. |
| 43 | * This affected polymodel.h, object.h, player.h, vecmat.h, room.h, |
| 44 | * manage.h and multi.h |
| 45 | * |
| 46 | * 7 12/18/98 6:00p Jeff |
| 47 | * added support for door scripts in new osiris |
| 48 | * |
| 49 | * 6 5/22/98 8:50p Matt |
| 50 | * Added sounds for doors |
| 51 | * |
| 52 | * 5 4/06/98 4:53p Jason |
| 53 | * got pageable polymodels working correctly with editor |
| 54 | * |
| 55 | * 4 2/02/98 7:07p Matt |
| 56 | * Added support for doors that can be seen through even when closed |
| 57 | * |
| 58 | * 3 10/06/97 1:01p Jason |
| 59 | * made doors work with scripts (sort of) |
| 60 | * |
| 61 | * 2 9/17/97 11:16a Matt |
| 62 | * Ripped out segment code |
| 63 | * |
| 64 | * 11 3/13/97 6:13p Jason |
| 65 | * got poly doors working |
| 66 | * |
| 67 | * 10 3/12/97 2:15p Samir |
| 68 | * Removed global references to doorways. |
| 69 | * |
| 70 | * 9 3/12/97 12:37p Samir |
| 71 | * added timing elements to door structure. |
| 72 | * |
| 73 | * 8 3/07/97 2:19p Jason |
| 74 | * added DrawDoorSegment function |
| 75 | * |
| 76 | * 7 3/05/97 2:59p Samir |
| 77 | * Made segnum, sidenum shorts and added prorotype for RemapDoors. |
| 78 | * |
| 79 | * 6 3/05/97 1:01p Samir |
| 80 | * Used doornum instead of polyobj in doorway struct |
| 81 | * |
| 82 | * 5 3/05/97 12:16p Jason |
| 83 | * added code to support our new 3d doors |
| 84 | * |
| 85 | * 4 2/27/97 5:09p Samir |
| 86 | * Key flags defined in door code. |
| 87 | * |
| 88 | * 3 2/26/97 4:25p Samir |
| 89 | * Call GetDoorFlags to get door info. |
| 90 | * |
| 91 | * 2 2/25/97 4:35p Samir |
| 92 | * Added SIDE_FLAGS macro. |
| 93 | * |
| 94 | * $NoKeywords: $ |
| 95 | */ |
| 96 | |
| 97 | #ifndef DOOR_H |
| 98 | #define DOOR_H |
| 99 | |
| 100 | #ifdef NEWEDITOR /* only include tablefile header (manage stuff for NEWEDITOR) */ |
| 101 | #include "..\neweditor\ned_TableFile.h" |
| 102 | #include "..\neweditor\ned_Door.h" |
| 103 | #include "pstypes.h" |
| 104 | #include "object.h" |
| 105 | #else |
| 106 | |
| 107 | #include "pstypes.h" |
| 108 | #include "manage.h" |
| 109 | #include "object.h" |
| 110 | |
| 111 | // IMPORTANT!!!!!!!!!!! |
| 112 | // "Doors" refers to a predefined door that is in memory |
| 113 | // "Doorways" are specific doors that are in the mine |
| 114 | // So, there can be several Doorways that all point to the same Door |
| 115 | // Get it? If not, talk to Samir or Jason |
| 116 | |
| 117 | // Door flags |
| 118 | |
| 119 | #define DF_BLASTABLE 1 // this door can be destroyed |
| 120 | #define DF_SEETHROUGH 2 // this door can be seen through even when closed |
| 121 | |
| 122 | // DOOR STRUCTURES |
| 123 | |
| 124 | struct door { |
| 125 | char name[PAGENAME_LEN]; // name of the door |
| 126 | uint8_t used; // if this door is in use |
| 127 | uint8_t flags; // flags for this door |
| 128 | uint8_t pad; // keep alignment (pagename is 35 chars long) |
| 129 | int16_t hit_points; // for blastable doors |
| 130 | float total_open_time; // time of animation to open door |
| 131 | float total_close_time; // time of animation to close door |
| 132 | float total_time_open; // how much time to stay open |
| 133 | int model_handle; // an index into the polymodels array |
| 134 | int open_sound; // sound to play when closing |
| 135 | int close_sound; // sound to play when closing |
| 136 | |
| 137 | // OSIRIS information |
| 138 | char module_name[MAX_MODULENAME_LEN]; |
| 139 | |
| 140 | }; |
| 141 | |
| 142 | // The max number of predefined doors |
| 143 | #define MAX_DOORS 60 |
| 144 | extern int Num_doors; // number of actual doors in game. |
| 145 | extern door Doors[]; |
| 146 | |
| 147 | // Sets all doors to unused |
| 148 | void InitDoors(); |
| 149 | |
| 150 | // Allocs a door for use, returns -1 if error, else index on success |
| 151 | int AllocDoor(); |
| 152 | |
| 153 | // Frees door index n |
| 154 | void FreeDoor(int n); |
| 155 | |
| 156 | // Gets next door from n that has actually been alloced |
| 157 | int GetNextDoor(int n); |
| 158 | // Gets previous door from n that has actually been alloced |
| 159 | int GetPrevDoor(int n); |
| 160 | // Searches thru all doors for a specific name, returns -1 if not found |
| 161 | // or index of door with name |
| 162 | int FindDoorName(const char *name); |
| 163 | |
| 164 | // Given a filename, loads the model found in that file |
| 165 | int LoadDoorImage(const char *filename, int pageable = 1); |
| 166 | // Given a door handle, returns an index to that doors model |
| 167 | int GetDoorImage(int handle); |
| 168 | |
| 169 | // Remaps the doors |
| 170 | void RemapDoors(); |
| 171 | |
| 172 | #endif |
| 173 | |
| 174 | #endif |