| 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/Mission.h $ |
| 21 | * $Revision: 41 $ |
| 22 | * $Date: 4/23/99 3:33p $ |
| 23 | * $Author: Kevin $ |
| 24 | * |
| 25 | * Mission level sequencing and management. |
| 26 | * |
| 27 | * $Log: /DescentIII/main/Mission.h $ |
| 28 | * |
| 29 | * 41 4/23/99 3:33p Kevin |
| 30 | * mission file/multiplayer mod keyword system |
| 31 | * |
| 32 | * 40 4/22/99 6:21p Kevin |
| 33 | * mission keywords |
| 34 | * |
| 35 | * 39 4/08/99 3:13p Matt |
| 36 | * Finished cleaning up level sequencing code. Got rid of all the "level |
| 37 | * minus one" stuff. |
| 38 | * |
| 39 | * 38 4/03/99 5:23p Matt |
| 40 | * Removed name, author, & description from the mission level structure. |
| 41 | * |
| 42 | * 37 4/03/99 5:05p Samir |
| 43 | * added ENDMISSION keyword to end a mission after a certain level. |
| 44 | * |
| 45 | * 36 3/24/99 1:23p Kevin |
| 46 | * Support for level specific progress screens. |
| 47 | * |
| 48 | * 35 2/10/99 4:56p Kevin |
| 49 | * Better progress indicator & prepare for Descent message |
| 50 | * |
| 51 | * 34 1/20/99 4:20p Samir |
| 52 | * finished secret level implementation. |
| 53 | * |
| 54 | * 33 1/19/99 1:15p Samir |
| 55 | * add on missions. |
| 56 | * |
| 57 | * 32 1/13/99 12:43p Jason |
| 58 | * fixed flickering exit menu screen |
| 59 | * |
| 60 | * 31 1/08/99 2:55p Samir |
| 61 | * Ripped out OSIRIS1. |
| 62 | * |
| 63 | * 30 1/05/99 10:59a Samir |
| 64 | * readded level objective flags. |
| 65 | * |
| 66 | * 29 1/04/99 5:44p Samir |
| 67 | * added game state flags. |
| 68 | * |
| 69 | * 28 12/16/98 3:24p Samir |
| 70 | * new way to get info on a mission (used to determine training mission |
| 71 | * too.) |
| 72 | * |
| 73 | * 27 12/16/98 1:57p Samir |
| 74 | * Replaced CleanupString2 with CleanupStr |
| 75 | * |
| 76 | * 26 12/03/98 12:51p Samir |
| 77 | * music score specified per level. |
| 78 | * |
| 79 | * 25 10/18/98 2:58p Jason |
| 80 | * fixes for beta4 |
| 81 | * |
| 82 | * 24 10/13/98 3:48p Samir |
| 83 | * added error checking if script failed to load (default). |
| 84 | * |
| 85 | * 23 10/08/98 7:29p Samir |
| 86 | * revamped sequencing. |
| 87 | * |
| 88 | * 22 10/02/98 5:46p Samir |
| 89 | * took out mission file objective text and replaced with level goals. |
| 90 | * |
| 91 | * 21 8/24/98 5:04p Kevin |
| 92 | * Made msn files have the option to not be playable in multiplayer |
| 93 | * |
| 94 | * 20 8/18/98 1:10a Samir |
| 95 | * some reorg of scripting and intrasave mission managment. |
| 96 | * |
| 97 | * 19 7/31/98 5:19p Samir |
| 98 | * mission filenames are dynamically allocated now to allow for pathnames |
| 99 | * (since we'd have too many 256 char arrays per level. |
| 100 | * |
| 101 | * 18 6/18/98 4:49p Kevin |
| 102 | * Updated multiplayer menus |
| 103 | * |
| 104 | * 17 5/21/98 2:32p Samir |
| 105 | * added full support for intra-mission level branching. |
| 106 | * |
| 107 | * 16 4/20/98 11:30a Jason |
| 108 | * Added ShowProgressScreen function |
| 109 | * |
| 110 | * 15 4/18/98 7:17a Samir |
| 111 | * Added level objective descriptions to mission file. |
| 112 | * |
| 113 | * 14 4/14/98 7:50p Matt |
| 114 | * Added system to keep info for each level |
| 115 | * |
| 116 | * 13 4/02/98 11:11a Samir |
| 117 | * Error checking for level load/misison init fail. |
| 118 | * |
| 119 | * 12 3/13/98 12:09p Samir |
| 120 | * Added InitMissionScript function header. |
| 121 | * |
| 122 | * 11 2/08/98 5:01p Samir |
| 123 | * New game sequencing changes. |
| 124 | * |
| 125 | * 10 11/12/97 2:47p Samir |
| 126 | * Added mission briefing name. |
| 127 | * |
| 128 | * 9 10/03/97 11:58a Samir |
| 129 | * Added mission name |
| 130 | * |
| 131 | * 8 10/02/97 12:36p Samir |
| 132 | * Redid game sequencing flow. |
| 133 | * |
| 134 | * 7 9/30/97 5:33p Samir |
| 135 | * Added GameSequencer. |
| 136 | * |
| 137 | * 6 9/24/97 2:58p Samir |
| 138 | * Moved some script defines from mission.h to ObjScript.h |
| 139 | * |
| 140 | * 5 9/10/97 1:59p Samir |
| 141 | * Added D3XProgram var to level structure. |
| 142 | * |
| 143 | * 4 8/15/97 6:33p Samir |
| 144 | * Changes reflecting enhanced editor scripting. |
| 145 | * |
| 146 | * 3 8/12/97 3:25p Samir |
| 147 | * Added QuickStart functions. |
| 148 | * |
| 149 | * 2 8/05/97 9:59a Samir |
| 150 | * Scripting stuff. |
| 151 | * |
| 152 | * 4 6/05/97 12:21p Samir |
| 153 | * Added more mission commands. |
| 154 | * |
| 155 | * 3 5/16/97 3:11p Samir |
| 156 | * Added a mission name and mission initializer. |
| 157 | * |
| 158 | * 2 5/15/97 2:09p Samir |
| 159 | * Added a bunch of sequencing from level to level, loading mission. |
| 160 | * |
| 161 | * 1 4/29/97 11:57a Samir |
| 162 | * Initial revision |
| 163 | * |
| 164 | * $NoKeywords: $ |
| 165 | */ |
| 166 | |
| 167 | #ifndef MISSION_H |
| 168 | #define MISSION_Hcxx . . $ `Descent3/Mission.h:168:9`! |
| 169 | |
| 170 | #include "pstypes.h"cxx . . $ `<file>/lib/pstypes.h`/ |
| 171 | #include "descent.h"cxx . . $ `<file>/Descent3/descent.h`/ |
| 172 | |
| 173 | // *** CONSTANTS *** |
| 174 | #define LOAD_PROGRESS_STARTcxx . . $ `Descent3/Mission.h:174:9`! 1 |
| 175 | #define LOAD_PROGRESS_LOADING_LEVELcxx . . $ `Descent3/Mission.h:175:9`! 2 |
| 176 | #define LOAD_PROGRESS_PAGING_DATAcxx . . $ `Descent3/Mission.h:176:9`! 3 |
| 177 | #define LOAD_PROGRESS_PREPAREcxx . . $ `Descent3/Mission.h:177:9`! 4 |
| 178 | #define LOAD_PROGRESS_DONEcxx . . $ `Descent3/Mission.h:178:9`! 200 |
| 179 | |
| 180 | // Load level progress worker |
| 181 | void LoadLevelProgresscxx . . $ LoadLevelProgress(818fb24820cdd2d5).(int step, float percent, const char *chunk = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 182 | |
| 183 | // array constants |
| 184 | const int MSN_FILENAMELENcxx . . $ MSN_FILENAMELEN. = _MAX_PATHcxx . . $ `linux/linux_fix.h:34:9`!, MSN_URLLENcxx . . $ MSN_URLLEN. = 256; |
| 185 | |
| 186 | #define MAX_KEYWORDLENcxx . . $ `Descent3/Mission.h:186:9`! 300 |
| 187 | |
| 188 | // increase this value if you are going to add more levels to a mission than the max. |
| 189 | const int MAX_LEVELS_PER_MISSIONcxx . . $ MAX_LEVELS_PER_MISSION. = 30; |
| 190 | |
| 191 | // mission flags. |
| 192 | const unsigned LVLFLAG_STARTMOVIEcxx . . $ LVLFLAG_STARTMOVIE. = 1, LVLFLAG_ENDMOVIEcxx . . $ LVLFLAG_ENDMOVIE. = 2, LVLFLAG_BRIEFINGcxx . . $ LVLFLAG_BRIEFING. = 4, LVLFLAG_SHIPSELECTcxx . . $ LVLFLAG_SHIPSELECT. = 8, |
| 193 | LVLFLAG_SPAWNSECRETcxx . . $ LVLFLAG_SPAWNSECRET. = 16, LVLFLAG_SPECIALHOGcxx . . $ LVLFLAG_SPECIALHOG. = 32, LVLFLAG_BRANCHcxx . . $ LVLFLAG_BRANCH. = 64, LVLFLAG_UNUSEDcxx . . $ LVLFLAG_UNUSED. = 128, |
| 194 | LVLFLAG_SCOREcxx . . $ LVLFLAG_SCORE. = 256, LVLFLAG_FINALcxx . . $ LVLFLAG_FINAL. = 512; |
| 195 | |
| 196 | const int LVLOBJ_NUMcxx . . $ LVLOBJ_NUM. = 4; |
| 197 | const uint16_tcxx . . $ uint16_t# LVLOBJF_SECONDARY1cxx . . $ LVLOBJF_SECONDARY1. = 1, LVLOBJF_SECONDARY2cxx . . $ LVLOBJF_SECONDARY2. = 2, LVLOBJF_SECONDARY3cxx . . $ LVLOBJF_SECONDARY3. = 4, LVLOBJF_SECONDARY4cxx . . $ LVLOBJF_SECONDARY4. = 8; |
| 198 | |
| 199 | // Struct for info about the current level |
| 200 | struct level_infocxx . . $ level_info# { |
| 201 | char namecxx . . $ level_info#name.[100]; |
| 202 | char designercxx . . $ level_info#designer.[100]; |
| 203 | char copyrightcxx . . $ level_info#copyright.[100]; |
| 204 | char notescxx . . $ level_info#notes.[1000]; |
| 205 | }; |
| 206 | |
| 207 | // Info about the current level |
| 208 | extern level_infocxx . . $ level_info# Level_infocxx . . $ Level_info.; |
| 209 | |
| 210 | // level information |
| 211 | struct tLevelNodecxx . . $ tLevelNode# { |
| 212 | // level flags |
| 213 | unsigned flagscxx . . $ tLevelNode#flags.; // level flags |
| 214 | unsigned objective_flagscxx . . $ tLevelNode#objective_flags.; // level objective flags |
| 215 | |
| 216 | // movies |
| 217 | char *movienamecxx . . $ tLevelNode#moviename.; |
| 218 | char *endmoviecxx . . $ tLevelNode#endmovie.; |
| 219 | |
| 220 | // level filename |
| 221 | char *filenamecxx . . $ tLevelNode#filename.; // mine filename. |
| 222 | char *briefnamecxx . . $ tLevelNode#briefname.; // briefing filename |
| 223 | char *hogcxx . . $ tLevelNode#hog.; // hog file name for this level |
| 224 | char *scorecxx . . $ tLevelNode#score.; // music score of level |
| 225 | char *progresscxx . . $ tLevelNode#progress.; // File name containing the progress background screen |
| 226 | |
| 227 | // level branching |
| 228 | uint8_tcxx . . $ uint8_t# lvlbranch0cxx . . $ tLevelNode#lvlbranch0., lvlbranch1cxx . . $ tLevelNode#lvlbranch1.; // FORK or BRANCH command |
| 229 | uint8_tcxx . . $ uint8_t# secretlvlcxx . . $ tLevelNode#secretlvl.; // SECRET command |
| 230 | uint8_tcxx . . $ uint8_t# padcxx . . $ tLevelNode#pad.; |
| 231 | }; |
| 232 | |
| 233 | // predefine mission state flags |
| 234 | #define MSN_STATE_SECRET_LEVELcxx . . $ `Descent3/Mission.h:234:9`! 0x80000000 |
| 235 | |
| 236 | struct tMissioncxx . . $ tMission# { |
| 237 | int mn3_handlecxx . . $ tMission#mn3_handle.; // if this mission was loaded from an MN3, this is the handle. |
| 238 | |
| 239 | unsigned game_state_flagscxx . . $ tMission#game_state_flags.; // game state information stored here (manipulated by scripting) |
| 240 | char *filenamecxx . . $ tMission#filename.; // filename of mission. |
| 241 | char namecxx . . $ tMission#name.[MSN_NAMELENcxx . . $ `Descent3/descent.h:181:9`!]; // name of mission |
| 242 | char authorcxx . . $ tMission#author.[MSN_NAMELENcxx . . $ `Descent3/descent.h:181:9`!]; // author of mission. |
| 243 | char desccxx . . $ tMission#desc.[MSN_NAMELENcxx . . $ `Descent3/descent.h:181:9`! * 4]; // description of mission |
| 244 | char *hogcxx . . $ tMission#hog.; // default hog filename |
| 245 | char emailcxx . . $ tMission#email.[MSN_URLLENcxx . . $ MSN_URLLEN.]; // email and web location |
| 246 | char webcxx . . $ tMission#web.[MSN_URLLENcxx . . $ MSN_URLLEN.]; |
| 247 | bool multiplayablecxx . . $ tMission#multiplayable.; // this level is multiplayer playable |
| 248 | bool singleplayablecxx . . $ tMission#singleplayable.; // this level is playable as a single player game |
| 249 | bool training_missioncxx . . $ tMission#training_mission.; // is this mission a training mission? |
| 250 | |
| 251 | // listing of levels. |
| 252 | int num_levelscxx . . $ tMission#num_levels.; // number of levels |
| 253 | int cur_levelcxx . . $ tMission#cur_level.; // current level playing. |
| 254 | tLevelNodecxx . . $ tLevelNode# *levelscxx . . $ tMission#levels.; // array of levels |
| 255 | }; |
| 256 | |
| 257 | // structyre used to get information about a mission |
| 258 | struct tMissionInfocxx . . $ tMissionInfo# { |
| 259 | char namecxx . . $ tMissionInfo#name.[MSN_NAMELENcxx . . $ `Descent3/descent.h:181:9`!]; |
| 260 | char authorcxx . . $ tMissionInfo#author.[MSN_NAMELENcxx . . $ `Descent3/descent.h:181:9`!]; |
| 261 | char desccxx . . $ tMissionInfo#desc.[MSN_NAMELENcxx . . $ `Descent3/descent.h:181:9`! * 4]; |
| 262 | bool multicxx . . $ tMissionInfo#multi.; |
| 263 | bool singlecxx . . $ tMissionInfo#single.; |
| 264 | bool trainingcxx . . $ tMissionInfo#training.; |
| 265 | int n_levelscxx . . $ tMissionInfo#n_levels.; |
| 266 | char keywordscxx . . $ tMissionInfo#keywords.[MAX_KEYWORDLENcxx . . $ `Descent3/Mission.h:186:9`!]; // Keywords for mods, so you can see if this mission supports a given mod |
| 267 | }; |
| 268 | |
| 269 | // Scripting information |
| 270 | |
| 271 | // the current mission being played. |
| 272 | extern tMissioncxx . . $ tMission# Current_missioncxx . . $ Current_mission.; |
| 273 | extern tLevelNodecxx . . $ tLevelNode# *Current_levelcxx . . $ Current_level.; |
| 274 | |
| 275 | extern char D3MissionsDircxx . . $ D3MissionsDir.[]; |
| 276 | |
| 277 | // Get the name field out of the mission file |
| 278 | const char *GetMissionNamecxx . . $ GetMissionName(fb58d2e09a2a1ce6).(const char *mission); |
| 279 | |
| 280 | // initializes mission system. |
| 281 | void InitMissioncxx . . $ InitMission(49f6e7a06ebc5aa8).(); |
| 282 | |
| 283 | // reset all states for a mission |
| 284 | void ResetMissioncxx . . $ ResetMission(49f6e7a06ebc5aa8).(); |
| 285 | |
| 286 | // loads and verifies a mission as the current mission, returns if valid of not. |
| 287 | bool LoadMissioncxx . . $ LoadMission(c5f7da30cbc0f4e9).(const char *msn); |
| 288 | |
| 289 | // initializes a level's script. |
| 290 | void InitLevelScriptcxx . . $ InitLevelScript(49f6e7a06ebc5aa8).(); |
| 291 | |
| 292 | // frees a level's script |
| 293 | void FreeLevelScriptcxx . . $ FreeLevelScript(49f6e7a06ebc5aa8).(); |
| 294 | |
| 295 | // does a mission briefing, returns if mission was canceled, a false, or 0 value. |
| 296 | bool DoMissionBriefingcxx . . $ DoMissionBriefing(83c267b20bac841a).(int level); |
| 297 | |
| 298 | // does the end mission stuff |
| 299 | void DoEndMissioncxx . . $ DoEndMission(49f6e7a06ebc5aa8).(); |
| 300 | |
| 301 | // does the mission movie stuff |
| 302 | void DoMissionMoviecxx . . $ DoMissionMovie(85c52e162fed56f9).(const char *movie); |
| 303 | |
| 304 | // loads a level and sets it as current level in mission |
| 305 | bool LoadMissionLevelcxx . . $ LoadMissionLevel(83c267b20bac841a).(int level); |
| 306 | |
| 307 | // initializes the mission script |
| 308 | bool InitMissionScriptcxx . . $ InitMissionScript(c9857a73d68e59ba).(); |
| 309 | |
| 310 | // Objectives |
| 311 | void CompletedPrimaryObjectivecxx . . $ CompletedPrimaryObjective(49f6e7a06ebc5aa8).(); |
| 312 | |
| 313 | // Shows text on a background |
| 314 | void ShowProgressScreencxx . . $ ShowProgressScreen(8d00172ec7558ddf).(const char *str, const char *str2 = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!, bool flip = true); |
| 315 | |
| 316 | // See if a mission file is multiplayer playable. |
| 317 | bool IsMissionMultiPlayablecxx . . $ IsMissionMultiPlayable(c5f7da30cbc0f4e9).(const char *mission); |
| 318 | |
| 319 | // return information about a mission |
| 320 | bool GetMissionInfocxx . . $ GetMissionInfo(5ac525d2e85070d7).(const char *msnfile, tMissionInfocxx . . $ tMissionInfo# *msn); |
| 321 | |
| 322 | // Returns the max number of teams this mission can support for this mod, or |
| 323 | //-1 if this level shouldn't be played with this mission |
| 324 | // Return values: |
| 325 | // -1 Bad match -- this level and this mod shouldn't be played together! |
| 326 | // MAX_NET_PLAYERS -- This is playable with any number of teams the mod wants |
| 327 | int MissionGetKeywordscxx . . $ MissionGetKeywords(2f051e3560ff300f).(const char *mission, char *keywords); |
| 328 | |
| 329 | #ifdef EDITOR |
| 330 | // Used by editor to load all necessary elements for level playing for systems |
| 331 | // not initialized in editor, but only in game. |
| 332 | void QuickStartMission(); |
| 333 | |
| 334 | // Used by game->editor to free up all extra game mission elements not needed in editor. |
| 335 | void QuickEndMission(); |
| 336 | |
| 337 | #endif |
| 338 | |
| 339 | #endif |