| 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/ship.h $ |
| 21 | * $Revision: 26 $ |
| 22 | * $Date: 8/29/01 4:27p $ |
| 23 | * $Author: Matt $ |
| 24 | * |
| 25 | * Header for player ship page |
| 26 | * |
| 27 | * $Log: /DescentIII/main/ship.h $ |
| 28 | * |
| 29 | * 26 8/29/01 4:27p Matt |
| 30 | * Increased MAX_SHIPS from 10 to 30 |
| 31 | * |
| 32 | * 25 2/04/00 9:52a Matt |
| 33 | * Increased MAX_SHIPS from 5 to 10 |
| 34 | * |
| 35 | * 24 5/13/99 12:29p Jeff |
| 36 | * made AllowedShips an extern |
| 37 | * |
| 38 | * 23 5/12/99 1:58p Jason |
| 39 | * fixed yet more buggy/ugly code |
| 40 | * |
| 41 | * 22 4/16/99 6:00p Kevin |
| 42 | * Bunches of Demo stuff |
| 43 | * |
| 44 | * 21 4/11/99 3:04p Matt |
| 45 | * Reduced the max number of player ships from 30 to 5. |
| 46 | * Re-wrote the static ship name code to be more space efficient. |
| 47 | * Took default ship name (the one used to find the ship) out of string |
| 48 | * table. |
| 49 | * |
| 50 | * 20 11/03/98 6:16p Chris |
| 51 | * Starting to make on/off and spray weapons accessable to robots |
| 52 | * |
| 53 | * 19 10/13/98 12:56p Matt |
| 54 | * Finished (hopefully) with the ammo system. Added support for napalm |
| 55 | * fuel. |
| 56 | * |
| 57 | * 18 10/12/98 3:02p Jeff |
| 58 | * moved DEFAULT_SHIP #define into ship.h |
| 59 | * |
| 60 | * 17 10/02/98 1:47p Jason |
| 61 | * added lod player ships |
| 62 | * |
| 63 | * 16 9/10/98 11:53a Jason |
| 64 | * added hud config filename to ship page |
| 65 | * |
| 66 | * 15 8/07/98 2:43p Jeff |
| 67 | * flags gets cleared and initialized correctly |
| 68 | * |
| 69 | * 14 8/06/98 10:59a Jason |
| 70 | * added zoom weapons |
| 71 | * |
| 72 | * 13 7/31/98 5:23p Jason |
| 73 | * added ship armor scalars |
| 74 | * |
| 75 | * 12 6/29/98 3:08p Jason |
| 76 | * added on/off weapons |
| 77 | * |
| 78 | * 11 6/16/98 10:54a Jeff |
| 79 | * |
| 80 | * 10 6/01/98 10:37a Matt |
| 81 | * Added system to spew powerups when the player dies. Still needs Jason |
| 82 | * to deal with mng_FindSpecificGenericPage(). |
| 83 | * |
| 84 | * 9 5/25/98 8:17p Matt |
| 85 | * Moved MAX_PLAYER_WEAPONS fromw weapon.h to player.h, so that the latter |
| 86 | * doesn't need to include the former, drastically speeding build times |
| 87 | * when weapon.h is changed. |
| 88 | * |
| 89 | * 8 3/19/98 1:02p Samir |
| 90 | * Added field for cockpit filename. |
| 91 | * |
| 92 | * 7 2/17/98 8:19p Matt |
| 93 | * Added looping & release sounds for player weapons |
| 94 | * |
| 95 | * 6 11/12/97 1:13p Jason |
| 96 | * added weapons that can ramp up |
| 97 | * |
| 98 | * 5 11/04/97 6:18p Chris |
| 99 | * Added support so that the player ship uses the robot's firing dialog. |
| 100 | * |
| 101 | * 4 10/21/97 11:57a Jason |
| 102 | * added ability to set dying model for player ship |
| 103 | * |
| 104 | * 3 9/03/97 4:37p Mark |
| 105 | * upped max_ship count |
| 106 | * |
| 107 | * 2 7/24/97 5:26p Matt |
| 108 | * Added SourceSafe header |
| 109 | * |
| 110 | * $NoKeywords: $ |
| 111 | */ |
| 112 | |
| 113 | #ifndef SHIP_H |
| 114 | #define SHIP_H |
| 115 | |
| 116 | #include "pstypes.h" |
| 117 | #include "manage.h" |
| 118 | #include "object.h" |
| 119 | #include "robotfirestruct.h" |
| 120 | #include "player.h" |
| 121 | |
| 122 | #define MAX_SHIPS 30 |
| 123 | |
| 124 | // #ifdef DEMO //Demo2 will use GL |
| 125 | // #define DEFAULT_SHIP "Pyro-SE" |
| 126 | // #else |
| 127 | #define DEFAULT_SHIP "Pyro-GL" |
| 128 | // #endif |
| 129 | |
| 130 | // Ship fire flags |
| 131 | #define SFF_FUSION 1 // fires like fusion |
| 132 | #define SFF_ZOOM 4 // Zooms in |
| 133 | #define SFF_TENTHS 8 // Ammo displays in tenths |
| 134 | |
| 135 | // Default ship IDs |
| 136 | #define SHIP_PYRO_ID 0 |
| 137 | #define SHIP_PHOENIX_ID 1 |
| 138 | #define SHIP_MAGNUM_ID 2 |
| 139 | |
| 140 | #define MAX_DEFAULT_SHIPS 3 |
| 141 | |
| 142 | // Ship flags |
| 143 | #define SF_DEFAULT_ALLOW 1 // Allowed by default |
| 144 | |
| 145 | struct ship { |
| 146 | char name[PAGENAME_LEN]; |
| 147 | float size; |
| 148 | physics_info phys_info; // the physics data for this obj type. |
| 149 | int model_handle; // a polygon model |
| 150 | int dying_model_handle; // Dying polygon model |
| 151 | |
| 152 | int med_render_handle; // handle for med res version of this object |
| 153 | int lo_render_handle; // handle for lo res version of this object |
| 154 | |
| 155 | float med_lod_distance; |
| 156 | float lo_lod_distance; |
| 157 | |
| 158 | otype_wb_info static_wb[MAX_PLAYER_WEAPONS]; |
| 159 | uint8_t fire_flags[MAX_PLAYER_WEAPONS]; // how a particular weapon fires |
| 160 | int max_ammo[MAX_PLAYER_WEAPONS]; |
| 161 | |
| 162 | int firing_sound[MAX_PLAYER_WEAPONS]; // sound the weapon makes while button held down |
| 163 | int firing_release_sound[MAX_PLAYER_WEAPONS]; // sound the weapon makes when the button is released |
| 164 | |
| 165 | int spew_powerup[MAX_PLAYER_WEAPONS]; // which powerup to spew for each weapon |
| 166 | |
| 167 | char cockpit_name[PAGENAME_LEN]; // name of cockpit.inf file |
| 168 | char hud_config_name[PAGENAME_LEN]; // name of hud configuration file |
| 169 | |
| 170 | float armor_scalar; |
| 171 | |
| 172 | int flags; |
| 173 | uint8_t used; |
| 174 | }; |
| 175 | |
| 176 | extern int Num_ships; |
| 177 | extern ship Ships[MAX_SHIPS]; |
| 178 | |
| 179 | extern const char *AllowedShips[]; |
| 180 | |
| 181 | // Sets all ships to unused |
| 182 | void InitShips(); |
| 183 | |
| 184 | // Allocs a ship for use, returns -1 if error, else index on success |
| 185 | int AllocShip(); |
| 186 | |
| 187 | // Frees ship index n |
| 188 | void FreeShip(int n); |
| 189 | |
| 190 | // Gets next ship from n that has actually been alloced |
| 191 | int GetNextShip(int n); |
| 192 | |
| 193 | // Gets previous ship from n that has actually been alloced |
| 194 | int GetPrevShip(int n); |
| 195 | |
| 196 | // Searches thru all ships for a specific name, returns -1 if not found |
| 197 | // or index of ship with name |
| 198 | int FindShipName(const char *name); |
| 199 | |
| 200 | // Given a filename, loads either the model or vclip found in that file. If type |
| 201 | // is not NULL, sets it to 1 if file is model, otherwise sets it to zero |
| 202 | int LoadShipImage(const char *filename); |
| 203 | |
| 204 | // Given a ship handle, returns that ships image for framenum |
| 205 | int GetShipImage(int handle); |
| 206 | |
| 207 | // This is a very confusing function. It takes all the ships that we have loaded |
| 208 | // and remaps then into their proper places (if they are static). |
| 209 | void RemapShips(); |
| 210 | |
| 211 | // goes thru every entity that could possible have a ship index (ie objects, ships, etc) |
| 212 | // and changes the old index to the new index |
| 213 | void RemapAllShipObjects(int old_index, int new_index); |
| 214 | |
| 215 | #endif |