| 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/editor/group.h $ |
| 21 | * $Revision: 1.1.1.1 $ |
| 22 | * $Date: 2003-08-26 03:57:38 $ |
| 23 | * $Author: kevinb $ |
| 24 | * |
| 25 | * Header for group.cpp |
| 26 | * |
| 27 | * $Log: not supported by cvs2svn $ |
| 28 | * |
| 29 | * 8 9/15/99 1:56p Matt |
| 30 | * Added the option to allow rooms or groups placed on the terrain to |
| 31 | * either align with the terrain or with gravity. |
| 32 | * |
| 33 | * 7 5/08/99 1:39a Matt |
| 34 | * Added a function to delete all objects of a certain type, and support |
| 35 | * for placing and attaching groups to the terrain. |
| 36 | * |
| 37 | * 6 12/01/98 11:22p Matt |
| 38 | * Made copy/paste work with doors. |
| 39 | * |
| 40 | * 5 9/22/97 2:31p Matt |
| 41 | * Made group code copy & paste objects & triggers |
| 42 | * |
| 43 | * 4 9/04/97 4:43p Matt |
| 44 | * Removed include of room.h to reduce compile times |
| 45 | * |
| 46 | * 3 9/02/97 6:42p Matt |
| 47 | * Got paste & group save/load working |
| 48 | * |
| 49 | * 2 8/29/97 5:45p Matt |
| 50 | * Converted group code to work with rooms (unfinished) |
| 51 | * |
| 52 | * 4 6/13/97 11:52a Matt |
| 53 | * Deleted now-unused RotateWorld() function |
| 54 | * |
| 55 | * 3 5/05/97 3:57p Matt |
| 56 | * Added code to rotate the mine (& the objects in it) to join with the |
| 57 | * terrain. |
| 58 | * |
| 59 | * 2 3/12/97 3:25p Matt |
| 60 | * Added funcs for cut, copy, paste, & delete, and to save and load |
| 61 | * groups. |
| 62 | * |
| 63 | * 1 3/11/97 10:48p Matt |
| 64 | * |
| 65 | * $NoKeywords: $ |
| 66 | */ |
| 67 | |
| 68 | #ifndef _GROUP_H |
| 69 | #define _GROUP_H |
| 70 | |
| 71 | // Define room, so we don't have to include room.h |
| 72 | struct room; |
| 73 | struct object; |
| 74 | struct trigger; |
| 75 | |
| 76 | // A group. Used for cut, paste, copy, etc. |
| 77 | struct group { |
| 78 | int nrooms; // number of rooms in this group |
| 79 | room *rooms; // pointer to list of rooms |
| 80 | int attachroom; // which room is attached when pasting |
| 81 | int attachface; // which face is attached when pasting |
| 82 | int nobjects; // how many objects |
| 83 | int ndoors; // how many doors |
| 84 | object *objects; // pointer to list of objects |
| 85 | int ntriggers; // how many triggers |
| 86 | trigger *triggers; // pointer to list of triggers |
| 87 | }; |
| 88 | |
| 89 | // Free a group. |
| 90 | // Parameters: g - the group to be freed |
| 91 | void FreeGroup(group *g); |
| 92 | |
| 93 | // Copy the given list of rooms to a group |
| 94 | // Parameters: nrooms - the number of rooms in list |
| 95 | // roomnums - pointer to list of room numbers |
| 96 | // attachroom, attachface - where group attaches when pasted |
| 97 | // Returns: pointer to group |
| 98 | group *CopyGroup(int nrooms, int *roomnums, int attachroom, int attachface); |
| 99 | |
| 100 | // Delete the given list of rooms |
| 101 | // Parameters: nrooms - the number of rooms in list |
| 102 | // roomnums - pointer to list of room numbers |
| 103 | void DeleteGroup(int nrooms, int *roomnums); |
| 104 | |
| 105 | // Place the given group at the specified room face |
| 106 | // The function merely causes the group to be drawn in the editor, allowing the user to line it up |
| 107 | // before attaching it. The function AttachGroup() must be called to do the actual attachment. |
| 108 | // Parameters: destroomp, destside - where to place the group |
| 109 | // g - the group to place |
| 110 | void PlaceGroup(room *destroomp, int destface, group *g); |
| 111 | |
| 112 | // Place the given group at the specified terrain cell |
| 113 | // The function merely causes the group to be drawn in the editor, allowing the user to line it up |
| 114 | // before attaching it. The function AttachGroup() must be called to do the actual attachment. |
| 115 | // Parameters: cellnum - where to place the group |
| 116 | // g - the group to place |
| 117 | void PlaceGroupTerrain(int cellnum, group *g, bool align_to_terrain); |
| 118 | |
| 119 | // Attach the already-placed group |
| 120 | void AttachGroup(); |
| 121 | |
| 122 | // Saves a group to disk in the given filename |
| 123 | void SaveGroup(char *filename, group *g); |
| 124 | |
| 125 | // Loads a group from disk |
| 126 | // Returns: pointer to the group loaded |
| 127 | group *LoadGroup(char *filename); |
| 128 | |
| 129 | #endif // ifdef _GROUP_H |