| 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.cpp $ |
| 21 | * $Revision: 193 $ |
| 22 | * $Date: 10/21/01 4:19p $ |
| 23 | * $Author: Kevin $ |
| 24 | * |
| 25 | * Mission level sequencing and management. |
| 26 | * |
| 27 | * $Log: /DescentIII/Main/Mission.cpp $ |
| 28 | * |
| 29 | * 193 10/21/01 4:19p Kevin |
| 30 | * Fix for bug 5566. Reset the URL structure on mission init |
| 31 | * |
| 32 | * 192 10/08/01 4:21p Matt |
| 33 | * If the mission has data errors, tell the user on the loading screen. |
| 34 | * |
| 35 | * 191 3/20/00 12:17p Matt |
| 36 | * Merge of Duane's post-1.3 changes. |
| 37 | * Mission name changes (Mac only) |
| 38 | * |
| 39 | * 190 11/05/99 12:18p Jay |
| 40 | * Fixed bugs with Jeff's fix |
| 41 | * |
| 42 | * 189 11/05/99 11:05a Jeff |
| 43 | * fixed mission movie playing |
| 44 | * |
| 45 | * 188 11/04/99 12:35a Chris |
| 46 | * Added support for Merc |
| 47 | * |
| 48 | * 187 10/25/99 9:52a Matt |
| 49 | * Mac merge |
| 50 | * |
| 51 | * 186 10/12/99 11:05a Jeff |
| 52 | * new msn keyword "SHIP" to override default ship to something else |
| 53 | * |
| 54 | * 185 10/04/99 9:58a Kevin |
| 55 | * Demo fixes for mac demo |
| 56 | * |
| 57 | * 184 8/10/99 5:12p Jeff |
| 58 | * fixed memory leak |
| 59 | * |
| 60 | * 183 7/28/99 4:03p Kevin |
| 61 | * Macintosh! |
| 62 | * |
| 63 | * 182 7/08/99 10:30a Kevin |
| 64 | * when loading a save game >level 4 from a minimal install, don't ask for |
| 65 | * CD1 |
| 66 | * |
| 67 | * 181 6/16/99 12:03p Kevin |
| 68 | * Fix a stupid bug where minimal installs won't open d3voicex.hog |
| 69 | * |
| 70 | * 180 6/10/99 4:12p Kevin |
| 71 | * Fixed SetLevel in dedicated server for HEAT.NET, and added |
| 72 | * level_names.str for level name localization. |
| 73 | * |
| 74 | * 179 6/03/99 8:48a Kevin |
| 75 | * fixes for new OEM version.... |
| 76 | * |
| 77 | * 178 5/20/99 6:21p Kevin |
| 78 | * Fixed HOARD keyword thingy |
| 79 | * |
| 80 | * 177 5/20/99 4:54p Jason |
| 81 | * added heartbeats to server |
| 82 | * |
| 83 | * 176 5/20/99 4:10p Jason |
| 84 | * added heartbeat to multiplayer so clients wouldn't time out, also |
| 85 | * various multiplayer fixes |
| 86 | * |
| 87 | * 175 5/20/99 3:40p Jason |
| 88 | * made mission looping work correctly in multiplayer |
| 89 | * |
| 90 | * 174 5/07/99 5:06p Jason |
| 91 | * display level name on loading screen |
| 92 | * |
| 93 | * 173 5/03/99 5:12p Jason |
| 94 | * fixing BOA vis problem... |
| 95 | * |
| 96 | * 172 5/03/99 3:35p Kevin |
| 97 | * bug fixes |
| 98 | * |
| 99 | * 171 5/02/99 2:32p Kevin |
| 100 | * fixed various dedicated server problems. |
| 101 | * |
| 102 | * 170 5/01/99 5:12p Jason |
| 103 | * put BOA check back in |
| 104 | * |
| 105 | * 169 5/01/99 4:06p Jeff |
| 106 | * fixed #include for linux |
| 107 | * |
| 108 | * 168 5/01/99 12:42p Kevin |
| 109 | * removed BOA warning. It was showing up for all levels with no terrain |
| 110 | * |
| 111 | * 167 4/30/99 5:41p Jason |
| 112 | * fixed some boa/terrain level issues |
| 113 | * |
| 114 | * 166 4/30/99 3:03p Kevin |
| 115 | * improved times restored count |
| 116 | * |
| 117 | * 165 4/30/99 2:21p Jason |
| 118 | * changes to verify level completeness |
| 119 | * |
| 120 | * 164 4/25/99 2:18p Kevin |
| 121 | * moved d3 main mission voice files into seperate hogs |
| 122 | * |
| 123 | * 163 4/23/99 10:34p Kevin |
| 124 | * fixed bad things with multiple CD code |
| 125 | * |
| 126 | * 162 4/23/99 5:32p Kevin |
| 127 | * Fixed a few mission bugs. |
| 128 | * |
| 129 | * 161 4/23/99 3:33p Kevin |
| 130 | * mission file/multiplayer mod keyword system |
| 131 | * |
| 132 | * 160 4/23/99 10:35a Kevin |
| 133 | * minor cosmetic changes to the load level screen |
| 134 | * |
| 135 | * 159 4/22/99 8:29p Kevin |
| 136 | * made psrand.h come after stdlib.h |
| 137 | * |
| 138 | * 158 4/22/99 9:53a Kevin |
| 139 | * Fixed some dedicated server crashes |
| 140 | * |
| 141 | * 157 4/21/99 2:15p Samir |
| 142 | * table file filter fixes. |
| 143 | * |
| 144 | * 156 4/20/99 3:32p Kevin |
| 145 | * new prepare for descent behaivor |
| 146 | * |
| 147 | * 155 4/20/99 2:47p Matt |
| 148 | * When playing from the editor, set the level number to 1. |
| 149 | * |
| 150 | * 154 4/20/99 12:44a Matt |
| 151 | * Use briefing font instead of HUD font for level loading messages. |
| 152 | * |
| 153 | * 153 4/19/99 6:10p Kevin |
| 154 | * Demo now only has one multiplayer level |
| 155 | * |
| 156 | * 152 4/18/99 1:56p Kevin |
| 157 | * Movie player fixes to avoid crashes running under the editor |
| 158 | * |
| 159 | * 151 4/17/99 6:15p Samir |
| 160 | * replaced gr.h with grdefs.h and fixed resulting compile bugs. |
| 161 | * |
| 162 | * 150 4/17/99 3:44p Kevin |
| 163 | * Demo2 changes & fixes |
| 164 | * |
| 165 | * 149 4/16/99 6:00p Kevin |
| 166 | * Bunches of Demo stuff |
| 167 | * |
| 168 | * 148 4/15/99 1:40a Jeff |
| 169 | * changes for linux compile |
| 170 | * |
| 171 | * 147 4/14/99 3:07p Kevin |
| 172 | * Fixed some multiple CD bugs |
| 173 | * |
| 174 | * 146 4/14/99 12:35p Samir |
| 175 | * localization issues. |
| 176 | * |
| 177 | * 145 4/14/99 2:51a Jeff |
| 178 | * fixed some case mismatched #includes |
| 179 | * |
| 180 | * 144 4/13/99 6:15p Kevin |
| 181 | * added TXT_PREPARE_FOR_DESCENT |
| 182 | * |
| 183 | * 143 4/11/99 4:45p Matt |
| 184 | * Added code for localization of level goal text. |
| 185 | * |
| 186 | * 142 4/08/99 3:13p Matt |
| 187 | * Finished cleaning up level sequencing code. Got rid of all the "level |
| 188 | * minus one" stuff. |
| 189 | * |
| 190 | * 141 4/07/99 3:40p Kevin |
| 191 | * Fixes for Beta 1 |
| 192 | * |
| 193 | * 140 4/07/99 12:30p Matt |
| 194 | * Added code for failed missions. |
| 195 | * |
| 196 | * 139 4/05/99 2:54p Samir |
| 197 | * display more errors for mission file load failures. |
| 198 | * |
| 199 | * 138 4/03/99 5:23p Matt |
| 200 | * Removed name, author, & description from the mission level structure. |
| 201 | * |
| 202 | * 137 4/03/99 5:05p Samir |
| 203 | * added ENDMISSION keyword to end a mission after a certain level. |
| 204 | * |
| 205 | * 136 3/31/99 10:28a Samir |
| 206 | * I think this is abug in DoMissionMovie. Passed the parameter |
| 207 | * (filename) to GetMultiCDPath. |
| 208 | * |
| 209 | * 135 3/29/99 5:32p Kevin |
| 210 | * Build fixes |
| 211 | * |
| 212 | * 134 3/24/99 3:54p Jeff |
| 213 | * much prettier dedicated server load progress indicators |
| 214 | * |
| 215 | * 133 3/24/99 2:56p Kevin |
| 216 | * Fixed level specific progress indicator to have a default for single |
| 217 | * player missions, and fixed the default mission name (put it in the |
| 218 | * stringtable) |
| 219 | * |
| 220 | * 132 3/24/99 1:23p Kevin |
| 221 | * Support for level specific progress screens. |
| 222 | * |
| 223 | * 131 3/24/99 11:42a Kevin |
| 224 | * Fixed multiplayer missions |
| 225 | * |
| 226 | * 130 3/24/99 10:54a Kevin |
| 227 | * Fixed some problems related to splitting up the main d3.mn3 file across |
| 228 | * 2 CDs |
| 229 | * |
| 230 | * 129 3/19/99 4:08p Kevin |
| 231 | * Multiple CD installation support |
| 232 | * |
| 233 | * 128 3/18/99 12:51p Samir |
| 234 | * debug info. |
| 235 | * |
| 236 | * 127 3/09/99 6:34p Kevin |
| 237 | * Made the training mission not be branching, and fixed the crash with |
| 238 | * people dying in the demo playback |
| 239 | * |
| 240 | * 126 3/05/99 5:24p Jeff |
| 241 | * fixed mission names for multiplayer levels in oem |
| 242 | * |
| 243 | * 125 3/04/99 5:24p Kevin |
| 244 | * Added filenames for OEM |
| 245 | * |
| 246 | * 124 3/03/99 7:20p Jeff |
| 247 | * music score added for oem levels |
| 248 | * |
| 249 | * 123 3/03/99 12:33a Kevin |
| 250 | * Minor OEM changes |
| 251 | * |
| 252 | * 122 3/02/99 7:20p Kevin |
| 253 | * |
| 254 | * 121 3/02/99 1:18p Samir |
| 255 | * reset srclinenum in LoadMission so error box reports correct line num. |
| 256 | * |
| 257 | * 120 3/02/99 11:52a Kevin |
| 258 | * Fixes for OEM Beta 4.1 |
| 259 | * |
| 260 | * 119 3/02/99 1:23a Kevin |
| 261 | * |
| 262 | * 117 3/02/99 12:32a Kevin |
| 263 | * |
| 264 | * 116 3/01/99 11:47p Kevin |
| 265 | * |
| 266 | * 115 3/01/99 11:38p Kevin |
| 267 | * |
| 268 | * 113 3/01/99 9:39p Kevin |
| 269 | * Doh! #elseif should have been #else |
| 270 | * |
| 271 | * 112 3/01/99 9:03p Kevin |
| 272 | * OEM Beta 4 |
| 273 | * |
| 274 | * 111 2/28/99 3:26a Samir |
| 275 | * redid newgame dialog. |
| 276 | * |
| 277 | * 110 2/26/99 2:11a Samir |
| 278 | * messagebox if misison load failed. |
| 279 | * |
| 280 | * 109 2/24/99 3:15p Kevin |
| 281 | * OEM menu changes, and bug fixes for the save/load system |
| 282 | * |
| 283 | * 108 2/24/99 2:03p Kevin |
| 284 | * fixed bug with flickering status bar |
| 285 | * |
| 286 | * 107 2/17/99 8:33p Samir |
| 287 | * fixed potential bugs with mission files that fail top open. |
| 288 | * |
| 289 | * 106 2/16/99 12:39p Kevin |
| 290 | * Improved paging data progress indicator |
| 291 | * |
| 292 | * 105 2/16/99 12:36a Kevin |
| 293 | * Fixes for release builds of OEM V3 and KAtmai |
| 294 | * |
| 295 | * 104 2/13/99 1:56p Kevin |
| 296 | * |
| 297 | * 103 2/10/99 4:56p Kevin |
| 298 | * Better progress indicator & prepare for Descent message |
| 299 | * |
| 300 | * 102 2/10/99 11:25a Kevin |
| 301 | * |
| 302 | * 101 2/09/99 7:01p Kevin |
| 303 | * First work for new and improved progress screen while loading a level. |
| 304 | * Note that this is a hack at this point, while I get the details worked |
| 305 | * out, then I'll make it cleaner. |
| 306 | * |
| 307 | * 100 2/04/99 9:28a Kevin |
| 308 | * Added a few OEM #ifdefs |
| 309 | * |
| 310 | * 99 2/03/99 4:20p Kevin |
| 311 | * Got multiplayer working with .mn3 files, and setup autodownloading |
| 312 | * |
| 313 | * 98 2/03/99 2:54p Jeff |
| 314 | * display telcom if there is a briefing and/or ships to choose from |
| 315 | * |
| 316 | * 97 1/29/99 5:22p Jeff |
| 317 | * localization |
| 318 | * |
| 319 | * 96 1/21/99 11:15p Jeff |
| 320 | * pulled out some structs and defines from header files and moved them |
| 321 | * into seperate header files so that multiplayer dlls don't require major |
| 322 | * game headers, just those new headers. Side effect is a shorter build |
| 323 | * time. Also cleaned up some header file #includes that weren't needed. |
| 324 | * This affected polymodel.h, object.h, player.h, vecmat.h, room.h, |
| 325 | * manage.h and multi.h |
| 326 | * |
| 327 | * 95 1/19/99 1:15p Samir |
| 328 | * add on missions. |
| 329 | * |
| 330 | * 94 1/16/99 10:39a Jeff |
| 331 | * added mission memory management to Osiris...only slightly tested. Need |
| 332 | * to solve game save/restore problem still |
| 333 | * |
| 334 | * 93 1/13/99 12:43p Jason |
| 335 | * fixed flickering exit menu screen |
| 336 | * |
| 337 | * 92 1/11/99 12:47p Jason |
| 338 | * misc changes for polishing |
| 339 | * |
| 340 | * 91 1/08/99 2:55p Samir |
| 341 | * Ripped out OSIRIS1. |
| 342 | * |
| 343 | * 90 1/04/99 5:44p Samir |
| 344 | * added game state flags. |
| 345 | * |
| 346 | * 89 12/30/98 12:15p Kevin |
| 347 | * Auto Mission Download system |
| 348 | * |
| 349 | * 88 12/17/98 12:08p Jeff |
| 350 | * first checkin of new implementation of OSIRIS (old OSIRIS no longer |
| 351 | * works) |
| 352 | * |
| 353 | * 87 12/16/98 3:24p Samir |
| 354 | * new way to get info on a mission (used to determine training mission |
| 355 | * too.) |
| 356 | * |
| 357 | * 86 12/16/98 1:57p Samir |
| 358 | * Replaced CleanupString2 with CleanupStr |
| 359 | * |
| 360 | * 85 12/03/98 12:51p Samir |
| 361 | * music score specified per level. |
| 362 | * |
| 363 | * 84 11/02/98 6:00p Jeff |
| 364 | * began adding single player ship selection |
| 365 | * |
| 366 | * 83 10/23/98 8:28p Samir |
| 367 | * enhanced load level screen. |
| 368 | * |
| 369 | * 82 10/23/98 12:52p Samir |
| 370 | * added gray backbar for non splash loading screens. |
| 371 | * |
| 372 | * 81 10/22/98 10:49p Samir |
| 373 | * print out real messages for loadlevel and clear bar when collating. |
| 374 | * |
| 375 | * 80 10/22/98 12:46a Matt |
| 376 | * Got rid of the loading screen before the briefing. Instead, menu.cpp |
| 377 | * shows the menu background screen (without the menu). |
| 378 | * |
| 379 | * 79 10/20/98 6:34p Jeff |
| 380 | * changes made to get dedicated server working |
| 381 | * |
| 382 | * 78 10/19/98 10:35p Kevin |
| 383 | * |
| 384 | * 77 10/19/98 7:51p Kevin |
| 385 | * performance testing |
| 386 | * |
| 387 | * 76 10/19/98 5:41p Samir |
| 388 | * fixed booboo. |
| 389 | * |
| 390 | * 75 10/19/98 5:39p Samir |
| 391 | * added loading level screen. |
| 392 | * |
| 393 | * 74 10/18/98 2:58p Jason |
| 394 | * fixes for beta4 |
| 395 | * |
| 396 | * 73 10/18/98 12:14p Jeff |
| 397 | * demo multiplayer mission loops |
| 398 | * |
| 399 | * 72 10/14/98 7:30p Matt |
| 400 | * Fixed compile warning |
| 401 | * |
| 402 | * 71 10/14/98 7:19p Kevin |
| 403 | * More dsp changes... |
| 404 | * |
| 405 | * 70 10/14/98 6:40p Samir |
| 406 | * ShowProgressScreen uses Max_window_w, and height. |
| 407 | * |
| 408 | * 69 10/13/98 3:48p Samir |
| 409 | * added error checking if script failed to load (default). |
| 410 | * |
| 411 | * 68 10/11/98 3:04a Jeff |
| 412 | * for the demo, new was being used to alloc the level node, when it |
| 413 | * should have been mem_malloc |
| 414 | * |
| 415 | * 67 10/09/98 6:58p Kevin |
| 416 | * changed demo level to polaris.d3l |
| 417 | * |
| 418 | * 66 10/08/98 7:29p Samir |
| 419 | * revamped sequencing. |
| 420 | * |
| 421 | * 65 10/08/98 4:23p Kevin |
| 422 | * Changed code to comply with memory library usage. Always use mem_malloc |
| 423 | * , mem_free and mem_strdup |
| 424 | * |
| 425 | * 64 10/07/98 11:34a Kevin |
| 426 | * |
| 427 | * 63 10/06/98 10:36a Kevin |
| 428 | * updated level names for demo |
| 429 | * |
| 430 | * 62 10/06/98 10:34a Kevin |
| 431 | * Put in demo code for multi |
| 432 | * |
| 433 | * 61 10/02/98 5:46p Samir |
| 434 | * took out mission file objective text and replaced with level goals. |
| 435 | * |
| 436 | * 60 9/22/98 3:56p Samir |
| 437 | * special demo code doesn't allow pilot and mission stuff. |
| 438 | * |
| 439 | * 59 9/15/98 4:31p Jason |
| 440 | * added more functionality for the dedicated server |
| 441 | * |
| 442 | * 58 9/14/98 6:28p Jason |
| 443 | * first pass at getting dedicated server working |
| 444 | * |
| 445 | * 57 8/28/98 12:57p Jeff |
| 446 | * parm added to TelComShow |
| 447 | * |
| 448 | * 56 8/27/98 2:51p Jeff |
| 449 | * made it so SHIFT-ESC exits the TelCom back to Main Menu |
| 450 | * |
| 451 | * 55 8/24/98 5:04p Kevin |
| 452 | * Made msn files have the option to not be playable in multiplayer |
| 453 | * |
| 454 | * 54 8/20/98 10:53a Samir |
| 455 | * check Current_level pointer for validity. |
| 456 | * |
| 457 | * 53 8/18/98 1:10a Samir |
| 458 | * some reorg of scripting and intrasave mission managment. |
| 459 | * |
| 460 | * 52 7/31/98 5:19p Samir |
| 461 | * mission filenames are dynamically allocated now to allow for pathnames |
| 462 | * (since we'd have too many 256 char arrays per level. |
| 463 | * |
| 464 | * 51 6/18/98 4:49p Kevin |
| 465 | * Updated multiplayer menus |
| 466 | * |
| 467 | * 50 6/16/98 10:54a Jeff |
| 468 | * |
| 469 | * 49 5/25/98 8:19p Samir |
| 470 | * skip telcom if no briefing file and other stuff. |
| 471 | * |
| 472 | * 48 5/21/98 2:32p Samir |
| 473 | * added full support for intra-mission level branching. |
| 474 | * |
| 475 | * 47 5/18/98 3:56p Samir |
| 476 | * added D3_FAST mode to quickly enter and exit games. |
| 477 | * |
| 478 | * 46 5/05/98 5:17p Samir |
| 479 | * took out loading level message. |
| 480 | * |
| 481 | * 45 4/24/98 1:53a Samir |
| 482 | * took care of a lot of scripting memory leaks. |
| 483 | * |
| 484 | * 44 4/21/98 4:15a Samir |
| 485 | * memory stuf. |
| 486 | * |
| 487 | * 43 4/20/98 11:30a Jason |
| 488 | * Added ShowProgressScreen function |
| 489 | * |
| 490 | * 42 4/18/98 7:17a Samir |
| 491 | * Added level objective descriptions to mission file. |
| 492 | * |
| 493 | * 41 4/14/98 7:50p Matt |
| 494 | * Added system to keep info for each level |
| 495 | * |
| 496 | * 40 4/02/98 11:11a Samir |
| 497 | * Error checking for level load/misison init fail. |
| 498 | * |
| 499 | * 39 3/31/98 3:49p Jason |
| 500 | * added memory lib |
| 501 | * |
| 502 | * 38 3/30/98 6:29p Samir |
| 503 | * Load default null script. |
| 504 | * |
| 505 | * 37 2/17/98 6:54p Samir |
| 506 | * clear screen. |
| 507 | * |
| 508 | * 36 2/17/98 6:13p Jeff |
| 509 | * Changed it so TelCom is forced to go into Briefings when called |
| 510 | * |
| 511 | * 35 2/17/98 4:42p Samir |
| 512 | * Current_level is now defined after calling DoLevelIntro. |
| 513 | * |
| 514 | * 34 2/13/98 10:57a Samir |
| 515 | * Changed some gamescript initialization. |
| 516 | * |
| 517 | * 33 2/12/98 5:08p Matt |
| 518 | * Reset cockpit mode when starting a level. Unfortunately, this involved |
| 519 | * some semi-major mucking with game sequencing. |
| 520 | * |
| 521 | * 32 2/08/98 5:01p Samir |
| 522 | * New game sequencing changes. |
| 523 | * |
| 524 | * 31 1/21/98 5:27p Jason |
| 525 | * Don't reposition player object if going from editor to game |
| 526 | * |
| 527 | * 30 1/21/98 1:11p Jason |
| 528 | * incremental checkin for multiplayer |
| 529 | * |
| 530 | * 29 1/20/98 6:01p Jason |
| 531 | * first pass at getting multiplayer deaths working |
| 532 | * |
| 533 | * 28 1/15/98 11:10a Jeff |
| 534 | * Added call to set font color before 'loading level' so its white, also |
| 535 | * turned back on Telcom |
| 536 | * |
| 537 | * 27 1/08/98 12:32p Samir |
| 538 | * Initialize new player ship when quick starting mission. |
| 539 | * |
| 540 | * 26 12/29/97 5:51p Samir |
| 541 | * Use new text system to draw "loading" screen. |
| 542 | * |
| 543 | * 25 12/19/97 12:33p Samir |
| 544 | * Dont call telcom for now. |
| 545 | * |
| 546 | * 24 11/16/97 3:43p Samir |
| 547 | * Briefing filename now defined in mission level structure. |
| 548 | * |
| 549 | * 23 11/10/97 12:37p Samir |
| 550 | * When leaving telcom, restore to cinematics mode for simple 2d message. |
| 551 | * |
| 552 | * 22 10/16/97 4:41p Samir |
| 553 | * Set initial level state to start when quick starting mission. |
| 554 | * |
| 555 | * 21 10/03/97 11:58a Samir |
| 556 | * Added mission name |
| 557 | * |
| 558 | * 20 10/02/97 12:36p Samir |
| 559 | * Redid game sequencing flow. |
| 560 | * |
| 561 | * 19 9/30/97 5:33p Samir |
| 562 | * Added GameSequencer. |
| 563 | * |
| 564 | * 18 9/22/97 5:59p Samir |
| 565 | * Changed ObjCScript system, so everything is broken, but it shouldn't |
| 566 | * crash the game. |
| 567 | * |
| 568 | * 17 9/15/97 6:26p Samir |
| 569 | * Added loading level message. |
| 570 | * |
| 571 | * 16 9/12/97 4:07p Samir |
| 572 | * Simplified movie playing. |
| 573 | * |
| 574 | * 15 9/10/97 4:40p Samir |
| 575 | * Fixed a boo-boo |
| 576 | * |
| 577 | * 14 9/10/97 3:59p Samir |
| 578 | * Inititalize a mini mission when playing from editor, and compile level |
| 579 | * script when playing from editor always. |
| 580 | * |
| 581 | * 13 9/10/97 1:56p Samir |
| 582 | * Added more scripting initialization. |
| 583 | * |
| 584 | * 12 9/05/97 1:21p Samir |
| 585 | * Moved around a bunch of initialization code to InitThisLevel which is |
| 586 | * located in game.cpp. This is called every time you die, start a |
| 587 | * level, etc. |
| 588 | * |
| 589 | * 11 8/21/97 5:57p Samir |
| 590 | * Added some scripti loading/saving calls and took out some useless |
| 591 | * interface stuff |
| 592 | * |
| 593 | * 10 8/15/97 6:33p Samir |
| 594 | * Changes reflecting enhanced editor scripting. |
| 595 | * |
| 596 | * 9 8/12/97 5:31p Jason |
| 597 | * nulled out pointer when quitting mission. |
| 598 | * |
| 599 | * 8 8/12/97 3:22p Samir |
| 600 | * Initialize scripts at start of level. |
| 601 | * |
| 602 | * 7 8/06/97 10:38a Samir |
| 603 | * Fixed call to D3XReallocProgram |
| 604 | * |
| 605 | * 6 8/05/97 9:59a Samir |
| 606 | * Scripting stuff. |
| 607 | * |
| 608 | * 5 7/23/97 3:55p Jeff |
| 609 | * fixed TeleCom* calls to TelCom |
| 610 | * |
| 611 | * 4 7/23/97 3:53p Jeff |
| 612 | * |
| 613 | * 3 7/23/97 3:43p Samir |
| 614 | * Added telecom stuff. |
| 615 | * |
| 616 | * 7 6/11/97 2:20p Samir |
| 617 | * Changed gameos to new system. |
| 618 | * |
| 619 | * 6 6/05/97 12:21p Samir |
| 620 | * Added more mission commands. |
| 621 | * |
| 622 | * 5 5/16/97 6:13p Samir |
| 623 | * Check for EOF in mission file this time. |
| 624 | * |
| 625 | * 4 5/16/97 3:11p Samir |
| 626 | * Added a mission name and mission initializer. |
| 627 | * |
| 628 | * 3 5/15/97 6:58p Samir |
| 629 | * Small briefing changes. |
| 630 | * |
| 631 | * 2 5/15/97 2:09p Samir |
| 632 | * Added a bunch of sequencing from level to level, loading mission. |
| 633 | * |
| 634 | * 1 4/29/97 11:57a Samir |
| 635 | * Initial revision |
| 636 | * |
| 637 | * $NoKeywords: $ |
| 638 | */ |
| 639 | |
| 640 | #include <cstring> |
| 641 | #include <cstdlib> |
| 642 | #include <filesystem> |
| 643 | |
| 644 | #include "Mission.h"cxx . . $ `<file>/Descent3/Mission.h`/ |
| 645 | #include "3d.h"cxx . . $ `<file>/lib/3d.h`/ |
| 646 | #include "LoadLevel.h"cxx . . $ `<file>/Descent3/LoadLevel.h`/ |
| 647 | #include "pserror.h"cxx . . $ `<file>/misc/pserror.h`/ |
| 648 | #include "cfile.h"cxx . . $ `<file>/cfile/cfile.h`/ |
| 649 | #include "gamefont.h"cxx . . $ `<file>/Descent3/gamefont.h`/ |
| 650 | #include "grdefs.h"cxx . . $ `<file>/lib/grdefs.h`/ |
| 651 | #include "descent.h"cxx . . $ `<file>/Descent3/descent.h`/ |
| 652 | #include "ddio.h"cxx . . $ `<file>/ddio/ddio.h`/ |
| 653 | #include "d3movie.h"cxx . . $ `<file>/Descent3/d3movie.h`/ |
| 654 | #include "program.h"cxx . . $ `<file>/Descent3/program.h`/ |
| 655 | #include "object.h"cxx . . $ `<file>/Descent3/object.h`/ |
| 656 | #include "objinit.h"cxx . . $ `<file>/Descent3/objinit.h`/ |
| 657 | #include "ObjScript.h"cxx . . $ `<file>/Descent3/ObjScript.h`/ |
| 658 | #include "application.h"cxx . . $ `<file>/lib/application.h`/ |
| 659 | #include "TelCom.h"cxx . . $ `<file>/Descent3/TelCom.h`/ |
| 660 | #include "game.h"cxx . . $ `<file>/Descent3/game.h`/ |
| 661 | #include "cinematics.h"cxx . . $ `<file>/Descent3/cinematics.h`/ |
| 662 | #include "player.h"cxx . . $ `<file>/Descent3/player.h`/ |
| 663 | #include "gamesequence.h"cxx . . $ `<file>/Descent3/gamesequence.h`/ |
| 664 | #include "mem.h"cxx . . $ `<file>/mem/mem.h`/ |
| 665 | #include "newui.h"cxx . . $ `<file>/Descent3/newui.h`/ |
| 666 | #include "stringtable.h"cxx . . $ `<file>/Descent3/stringtable.h`/ |
| 667 | #include "AppConsole.h"cxx . . $ `<file>/lib/AppConsole.h`/ |
| 668 | #include "pstring.h"cxx . . $ `<file>/misc/pstring.h`/ |
| 669 | #include "dedicated_server.h"cxx . . $ `<file>/lib/dedicated_server.h`/ |
| 670 | #include "osiris_dll.h"cxx . . $ `<file>/Descent3/osiris_dll.h`/ |
| 671 | #include "mission_download.h"cxx . . $ `<file>/Descent3/mission_download.h`/ |
| 672 | #include "manage.h"cxx . . $ `<file>/lib/manage.h`/ |
| 673 | #include "ship.h"cxx . . $ `<file>/Descent3/ship.h`/ |
| 674 | #include "BOA.h"cxx . . $ `<file>/Descent3/BOA.h`/ |
| 675 | #include "terrain.h"cxx . . $ `<file>/Descent3/terrain.h`/ |
| 676 | #include "multi.h"cxx . . $ `<file>/Descent3/multi.h`/ |
| 677 | #include "hud.h"cxx . . $ `<file>/Descent3/hud.h`/ |
| 678 | // --------------------------------------------------------------------------- |
| 679 | // Data |
| 680 | // --------------------------------------------------------------------------- |
| 681 | // Info about the current level |
| 682 | level_infocxx . . $ level_info# Level_infocxx . . $ Level_info.; |
| 683 | tMissioncxx . . $ tMission# Current_missioncxx . . $ Current_mission.; |
| 684 | tLevelNodecxx . . $ tLevelNode# *Current_levelcxx . . $ Current_level. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 685 | char D3MissionsDircxx . . $ D3MissionsDir.[_MAX_PATHcxx . . $ `linux/linux_fix.h:34:9`!]; |
| 686 | extern int Times_game_restoredcxx . . $ Times_game_restored.; |
| 687 | extern msn_urlscxx . . $ msn_urls# Net_msn_URLscxx . . $ Net_msn_URLs.; |
| 688 | |
| 689 | // --------------------------------------------------------------------------- |
| 690 | // Function prototypes |
| 691 | // --------------------------------------------------------------------------- |
| 692 | bool InitMissionScriptcxx . . $ InitMissionScript(c9857a73d68e59ba).(); |
| 693 | void DoEndMissioncxx . . $ DoEndMission(49f6e7a06ebc5aa8).(); |
| 694 | void DoMissionMoviecxx . . $ DoMissionMovie(85c52e162fed56f9).(const char *movie); |
| 695 | void FreeMissioncxx . . $ FreeMission(49f6e7a06ebc5aa8).(); |
| 696 | // used in load level callback |
| 697 | void LoadLevelCBcxx . . $ LoadLevelCB(7b85637613228108).(const char *chunk, int curlen, int filelen); |
| 698 | // MN3 based mission functions. |
| 699 | // loads the msn file from the mn3 file specified, specifies the hog and table file. |
| 700 | bool mn3_Opencxx . . $ mn3_Open(c5f7da30cbc0f4e9).(const char *mn3file); |
| 701 | // returns mission information given the mn3 file. |
| 702 | bool mn3_GetInfocxx . . $ mn3_GetInfo(5ac525d2e85070d7).(const char *mn3file, tMissionInfocxx . . $ tMissionInfo# *msn); |
| 703 | // closes the current mn3 file |
| 704 | void mn3_Closecxx . . $ mn3_Close(49f6e7a06ebc5aa8).(); |
| 705 | |
| 706 | static inline bool IS_MN3_FILEcxx . . $ IS_MN3_FILE(c5f7da30cbc0f4e9).(const char *fname) { |
| 707 | char name[PSFILENAME_LENcxx . . $ `lib/pstypes.h:31:9`! + 1]; |
| 708 | char ext[PSFILENAME_LENcxx . . $ `lib/pstypes.h:31:9`! + 1]; |
| 709 | ddio_SplitPathcxx . . $ ddio_SplitPath(b05ba7ab99603c07).(fname, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, name, ext); |
| 710 | return (stricmpcxx . . $ `linux/linux_fix.h:43:9`!(ext, ".mn3") == 0) ? true : false; |
| 711 | } |
| 712 | |
| 713 | static inline char *MN3_TO_MSN_NAMEcxx . . $ MN3_TO_MSN_NAME(ed8193f262e4eda).(const char *mn3name, char *msnname) { |
| 714 | char fname[PSFILENAME_LENcxx . . $ `lib/pstypes.h:31:9`! + 1]; |
| 715 | ddio_SplitPathcxx . . $ ddio_SplitPath(b05ba7ab99603c07).(mn3name, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, fname, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 716 | |
| 717 | if (stricmpcxx . . $ `linux/linux_fix.h:43:9`!(fname, "d3_2") == 0) { |
| 718 | strcpy(fname, "d3"); |
| 719 | } |
| 720 | strcat(fname, ".msn"); |
| 721 | strcpy(msnname, fname); |
| 722 | return msnname; |
| 723 | } |
| 724 | |
| 725 | // --------------------------------------------------------------------------- |
| 726 | // Functions |
| 727 | // --------------------------------------------------------------------------- |
| 728 | |
| 729 | /////////////////////////////////////////////////////////////////////////////// |
| 730 | // High level mission stuff |
| 731 | /////////////////////////////////////////////////////////////////////////////// |
| 732 | void InitMissioncxx . . $ InitMission(49f6e7a06ebc5aa8).() { |
| 733 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "In InitMission()\n"); |
| 734 | Current_missioncxx . . $ Current_mission..num_levelscxx . . $ tMission#num_levels. = 0; |
| 735 | Current_missioncxx . . $ Current_mission..cur_levelcxx . . $ tMission#cur_level. = 0; |
| 736 | memset(Current_missioncxx . . $ Current_mission..desccxx . . $ tMission#desc., 0, sizeof(Current_missioncxx . . $ Current_mission..desccxx . . $ tMission#desc.)); |
| 737 | memset(Current_missioncxx . . $ Current_mission..namecxx . . $ tMission#name., 0, MSN_NAMELENcxx . . $ `Descent3/descent.h:181:9`!); |
| 738 | memset(Current_missioncxx . . $ Current_mission..authorcxx . . $ tMission#author., 0, MSN_NAMELENcxx . . $ `Descent3/descent.h:181:9`!); |
| 739 | memset(Current_missioncxx . . $ Current_mission..emailcxx . . $ tMission#email., 0, MSN_URLLENcxx . . $ MSN_URLLEN.); |
| 740 | memset(Current_missioncxx . . $ Current_mission..webcxx . . $ tMission#web., 0, MSN_URLLENcxx . . $ MSN_URLLEN.); |
| 741 | Current_missioncxx . . $ Current_mission..hogcxx . . $ tMission#hog. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 742 | Current_missioncxx . . $ Current_mission..levelscxx . . $ tMission#levels. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 743 | Current_missioncxx . . $ Current_mission..filenamecxx . . $ tMission#filename. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 744 | Current_missioncxx . . $ Current_mission..game_state_flagscxx . . $ tMission#game_state_flags. = 0; |
| 745 | Current_missioncxx . . $ Current_mission..mn3_handlecxx . . $ tMission#mn3_handle. = 0; |
| 746 | // create add on mission directory |
| 747 | ddio_MakePathcxx . . $ ddio_MakePath(9ad4b0815420a85).(D3MissionsDircxx . . $ D3MissionsDir., LocalD3Dircxx . . $ LocalD3Dir., "missions", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 748 | stdcxx . . $ std/::error_codecxx . . $ std/error_code# eccxx . . $ std/error_code#error_code(ced63f7c635d850d).; |
| 749 | stdcxx . . $ std/::filesystemcxx . . $ std/filesystem/::create_directoriescxx . . $ std/filesystem/create_directories(d743b8a22d0b5f99).(D3MissionsDircxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d)., ec); |
| 750 | if (ec) { |
| 751 | Errorcxx . . $ Error(326aeb464d16410c).(TXT_MSN_FAILEDCREATEDIRcxx . . $ `Descent3/stringtable.h:818:9`!); |
| 752 | } |
| 753 | atexit(ResetMissioncxx . . $ ResetMission(49f6e7a06ebc5aa8).); |
| 754 | } |
| 755 | // reset all states for a mission |
| 756 | void ResetMissioncxx . . $ ResetMission(49f6e7a06ebc5aa8).() { |
| 757 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "In ResetMission()\n"); |
| 758 | FreeMissioncxx . . $ FreeMission(49f6e7a06ebc5aa8).(); |
| 759 | Current_missioncxx . . $ Current_mission..num_levelscxx . . $ tMission#num_levels. = 0; |
| 760 | Current_missioncxx . . $ Current_mission..cur_levelcxx . . $ tMission#cur_level. = 0; |
| 761 | memset(Current_missioncxx . . $ Current_mission..desccxx . . $ tMission#desc., 0, sizeof(Current_missioncxx . . $ Current_mission..desccxx . . $ tMission#desc.)); |
| 762 | memset(Current_missioncxx . . $ Current_mission..namecxx . . $ tMission#name., 0, MSN_NAMELENcxx . . $ `Descent3/descent.h:181:9`!); |
| 763 | memset(Current_missioncxx . . $ Current_mission..authorcxx . . $ tMission#author., 0, MSN_NAMELENcxx . . $ `Descent3/descent.h:181:9`!); |
| 764 | memset(Current_missioncxx . . $ Current_mission..emailcxx . . $ tMission#email., 0, MSN_URLLENcxx . . $ MSN_URLLEN.); |
| 765 | memset(Current_missioncxx . . $ Current_mission..webcxx . . $ tMission#web., 0, MSN_URLLENcxx . . $ MSN_URLLEN.); |
| 766 | Current_missioncxx . . $ Current_mission..hogcxx . . $ tMission#hog. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 767 | Current_missioncxx . . $ Current_mission..levelscxx . . $ tMission#levels. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 768 | Current_missioncxx . . $ Current_mission..filenamecxx . . $ tMission#filename. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 769 | Current_missioncxx . . $ Current_mission..game_state_flagscxx . . $ tMission#game_state_flags. = 0; |
| 770 | |
| 771 | // clear out old URLs from memory |
| 772 | for (int a = 0; a < MAX_MISSION_URL_COUNTcxx . . $ `Descent3/mission_download.h:48:9`!; a++) { |
| 773 | Net_msn_URLscxx . . $ Net_msn_URLs..URLcxx . . $ msn_urls#URL.[a][0] = '\0'; |
| 774 | } |
| 775 | } |
| 776 | #if (defined(OEM) || defined(DEMO)) |
| 777 | bool DemoMission(int mode = 0) { |
| 778 | tMission *msn = &Current_mission; |
| 779 | tLevelNode *lvls = (tLevelNode *)mem_malloc(sizeof(tLevelNode) * 5); |
| 780 | msn->cur_level = 1; |
| 781 | msn->num_levels = 1; |
| 782 | msn->levels = lvls; |
| 783 | |
| 784 | msn->multiplayable = true; |
| 785 | msn->singleplayable = true; |
| 786 | |
| 787 | memset(lvls, 0, sizeof(tLevelNode) * msn->num_levels); |
| 788 | strncpy(msn->author, "Outrage", MSN_NAMELEN - 1); |
| 789 | if (!mode) { |
| 790 | strcpy(msn->name, "Descent 3: Sol Ascent"); |
| 791 | msn->num_levels = 5; |
| 792 | memset(lvls, 0, sizeof(tLevelNode) * msn->num_levels); |
| 793 | #ifdef DEMO |
| 794 | msn->multiplayable = false; |
| 795 | strcpy(msn->name, "Descent 3: Demo2"); |
| 796 | msn->num_levels = 1; |
| 797 | msn->filename = mem_strdup("d3demo.mn3"); |
| 798 | #else |
| 799 | strcpy(msn->name, "Descent 3: Sol Ascent"); |
| 800 | msn->num_levels = 5; |
| 801 | msn->filename = mem_strdup("d3oem.mn3"); |
| 802 | #endif |
| 803 | // strncpy(lvls[0].name, "Search for Sweitzer", MSN_NAMELEN-1); |
| 804 | lvls[0].flags = LVLFLAG_BRIEFING | LVLFLAG_SCORE; |
| 805 | lvls[0].filename = mem_strdup("level1.d3l"); |
| 806 | lvls[0].briefname = mem_strdup("level1.brf"); |
| 807 | lvls[0].score = mem_strdup("level1.omf"); |
| 808 | lvls[0].progress = mem_strdup("l1load.ogf"); |
| 809 | lvls[0].moviename = mem_strdup("level1.mve"); |
| 810 | #ifndef DEMO |
| 811 | // strncpy(lvls[0].name, "Into the Heart of the Ship", MSN_NAMELEN-1); |
| 812 | lvls[1].flags = LVLFLAG_BRIEFING | LVLFLAG_SCORE; |
| 813 | lvls[1].filename = mem_strdup("level3.d3l"); |
| 814 | lvls[1].briefname = mem_strdup("level2o.brf"); |
| 815 | lvls[1].score = mem_strdup("level3.omf"); |
| 816 | lvls[1].progress = mem_strdup("l3load.ogf"); |
| 817 | // strncpy(lvls[0].name, "The Nomad Caves", MSN_NAMELEN-1); |
| 818 | lvls[2].flags = LVLFLAG_BRIEFING | LVLFLAG_SCORE; |
| 819 | lvls[2].filename = mem_strdup("level6.d3l"); |
| 820 | lvls[2].briefname = mem_strdup("level3o.brf"); |
| 821 | lvls[2].score = mem_strdup("level6.omf"); |
| 822 | lvls[2].progress = mem_strdup("l6load.ogf"); |
| 823 | // strncpy(lvls[0].name, "The Transmode Virus", MSN_NAMELEN-1); |
| 824 | lvls[3].flags = LVLFLAG_BRIEFING | LVLFLAG_SCORE; |
| 825 | lvls[3].filename = mem_strdup("level7.d3l"); |
| 826 | lvls[3].briefname = mem_strdup("level4o.brf"); |
| 827 | lvls[3].score = mem_strdup("level7.omf"); |
| 828 | lvls[3].progress = mem_strdup("l7load.ogf"); |
| 829 | // strncpy(lvls[0].name, "The Rescue", MSN_NAMELEN-1); |
| 830 | lvls[4].flags = LVLFLAG_BRIEFING | LVLFLAG_SCORE; |
| 831 | lvls[4].filename = mem_strdup("level11.d3l"); |
| 832 | lvls[4].briefname = mem_strdup("level5o.brf"); |
| 833 | lvls[4].score = mem_strdup("level11.omf"); |
| 834 | lvls[4].progress = mem_strdup("l11load.ogf"); |
| 835 | mn3_Open("d3oem.mn3"); |
| 836 | #endif |
| 837 | |
| 838 | } |
| 839 | |
| 840 | else if (mode == 1) { |
| 841 | strcpy(msn->name, "Polaris"); |
| 842 | msn->filename = mem_strdup("Polaris.d3l"); |
| 843 | // strncpy(lvls[0].name, "Polaris", MSN_NAMELEN-1); |
| 844 | lvls[0].filename = mem_strdup("polaris.d3l"); |
| 845 | lvls[0].flags |= LVLFLAG_BRANCH; |
| 846 | lvls[0].lvlbranch0 = 1; |
| 847 | lvls[0].progress = mem_strdup("polaris.ogf"); |
| 848 | } else if (mode == 2) { |
| 849 | strcpy(msn->name, "The Core"); |
| 850 | msn->filename = mem_strdup("TheCore.d3l"); |
| 851 | // strncpy(lvls[0].name, "The Core", MSN_NAMELEN-1); |
| 852 | lvls[0].filename = mem_strdup("thecore.d3l"); |
| 853 | lvls[0].flags |= LVLFLAG_BRANCH; |
| 854 | lvls[0].lvlbranch0 = 1; |
| 855 | lvls[0].progress = mem_strdup("thecore.ogf"); |
| 856 | } else if (mode == 3) { |
| 857 | strcpy(msn->name, "Taurus"); |
| 858 | msn->filename = mem_strdup("Taurus.d3l"); |
| 859 | // strncpy(lvls[0].name, "Taurus", MSN_NAMELEN-1); |
| 860 | lvls[0].filename = mem_strdup("taurus.d3l"); |
| 861 | lvls[0].flags |= LVLFLAG_BRANCH; |
| 862 | lvls[0].lvlbranch0 = 1; |
| 863 | lvls[0].progress = mem_strdup("taurus.ogf"); |
| 864 | } |
| 865 | #ifndef DEMO |
| 866 | else if (mode == 4) { |
| 867 | strcpy(msn->name, "Pilot Training"); |
| 868 | msn->filename = mem_strdup("training.mn3"); |
| 869 | // strncpy(lvls[0].name, "Training", MSN_NAMELEN-1); |
| 870 | lvls[0].filename = mem_strdup("trainingmission.d3l"); |
| 871 | lvls[0].briefname = NULL; // mem_strdup("training.brf"); |
| 872 | lvls[0].flags = 0; |
| 873 | lvls[0].lvlbranch0 = 0; |
| 874 | lvls[0].progress = mem_strdup("trainingload.ogf"); |
| 875 | mn3_Open("training.mn3"); |
| 876 | } |
| 877 | #endif |
| 878 | // load default script here. |
| 879 | InitMissionScript(); |
| 880 | return true; |
| 881 | } |
| 882 | #endif |
| 883 | |
| 884 | bool LoadMissioncxx . . $ LoadMission(c5f7da30cbc0f4e9).(const char *mssn) { |
| 885 | Times_game_restoredcxx . . $ Times_game_restored. = 0; |
| 886 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "In LoadMission()\n"); |
| 887 | // ShowProgressScreen(TXT_LOADINGLEVEL); |
| 888 | #if (defined(OEM) || defined(DEMO)) |
| 889 | #ifdef OEM |
| 890 | if (stricmp(mssn, "d3oem.mn3") == 0) |
| 891 | return DemoMission(0); |
| 892 | #elif defined(DEMO) |
| 893 | if (stricmp(mssn, "d3demo.mn3") == 0) |
| 894 | return DemoMission(0); |
| 895 | #endif |
| 896 | else if (stricmp(mssn, "polaris.d3l") == 0) |
| 897 | return DemoMission(1); |
| 898 | else if (stricmp(mssn, "thecore.d3l") == 0) |
| 899 | return DemoMission(2); |
| 900 | else if (stricmp(mssn, "taurus.d3l") == 0) |
| 901 | return DemoMission(3); |
| 902 | #ifdef OEM |
| 903 | else if (stricmp(mssn, "training.mn3") == 0) |
| 904 | return DemoMission(4); |
| 905 | #endif |
| 906 | #else |
| 907 | |
| 908 | // #endif |
| 909 | tLevelNodecxx . . $ tLevelNode# *lvls = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; // Temporary storage for level data. |
| 910 | tMissioncxx . . $ tMission# *msn; |
| 911 | CFILEcxx . . $ CFILE# *fp = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; // Mission file |
| 912 | char errtext[80]; // Stores error if unable to read mission |
| 913 | char msnfname[_MAX_PATHcxx . . $ `linux/linux_fix.h:34:9`!]; |
| 914 | char mission[_MAX_PATHcxx . . $ `linux/linux_fix.h:34:9`!]; |
| 915 | int srclinenum = 0; // Current line of source. |
| 916 | int curlvlnum; // Current level number |
| 917 | int numlevels; // Number of levels required to read in. |
| 918 | int cur_objective; // current objective reading. |
| 919 | bool indesc; // are we in a multi-line block |
| 920 | bool res = false; // used to specify if no error has occurred. |
| 921 | char pathname[_MAX_PATHcxx . . $ `linux/linux_fix.h:34:9`!]; |
| 922 | ResetMissioncxx . . $ ResetMission(49f6e7a06ebc5aa8).(); // Reset everything. |
| 923 | // open MN3 if filename passed was an mn3 file. |
| 924 | |
| 925 | if (IS_MN3_FILEcxx . . $ IS_MN3_FILE(c5f7da30cbc0f4e9).(mssn)) { |
| 926 | strcpy(mission, mssn); |
| 927 | ddio_MakePathcxx . . $ ddio_MakePath(9ad4b0815420a85).(pathname, D3MissionsDircxx . . $ D3MissionsDir., mission, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 928 | } else { |
| 929 | strcpy(mission, mssn); |
| 930 | strcpy(pathname, mssn); |
| 931 | strcpy(msnfname, mssn); |
| 932 | // ddio_MakePath(pathname, D3MissionsDir, mission, NULL); |
| 933 | } |
| 934 | if (IS_MN3_FILEcxx . . $ IS_MN3_FILE(c5f7da30cbc0f4e9).(mission)) { |
| 935 | |
| 936 | if (!mn3_Opencxx . . $ mn3_Open(c5f7da30cbc0f4e9).(pathname)) { |
| 937 | strcpy(errtext, TXT_MSN_OPENMN3FAILEDcxx . . $ `Descent3/stringtable.h:812:9`!); |
| 938 | goto msnfile_error; |
| 939 | } |
| 940 | MN3_TO_MSN_NAMEcxx . . $ MN3_TO_MSN_NAME(ed8193f262e4eda).(mission, msnfname); |
| 941 | } |
| 942 | // open mission file |
| 943 | fp = cfopencxx . . $ cfopen(7c7b94e455f1ae56).(msnfnamecxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d)., "rt"); |
| 944 | if (!fp) { |
| 945 | strcpy(errtext, TXT_MISSIONNOTFOUNDcxx . . $ `Descent3/stringtable.h:598:9`!); |
| 946 | goto msnfile_error; |
| 947 | } |
| 948 | msn = &Current_missioncxx . . $ Current_mission.; |
| 949 | |
| 950 | // read in mission file |
| 951 | srclinenum = 1; |
| 952 | numlevels = -1; |
| 953 | curlvlnum = 0; |
| 954 | indesc = 0; |
| 955 | cur_objective = -1; |
| 956 | msn->multiplayablecxx . . $ tMission#multiplayable. = true; |
| 957 | msn->singleplayablecxx . . $ tMission#singleplayable. = true; |
| 958 | msn->training_missioncxx . . $ tMission#training_mission. = false; |
| 959 | |
| 960 | while (!cfeofcxx . . $ cfeof(413716a422df0036).(fp)) { |
| 961 | char srcline[128]; // One line of mission source |
| 962 | char command[32]; // Command read from line. |
| 963 | char operand[96]; // operand read from line |
| 964 | char *keyword; // parsed keyword |
| 965 | int readcount; // read-in count |
| 966 | readcount = cf_ReadStringcxx . . $ cf_ReadString(38cd788e4423eff6).(srcline, sizeof(srcline), fp); |
| 967 | if (readcount) { |
| 968 | // we have a line of source. parse out primary keyword |
| 969 | // then parse out remainder. |
| 970 | keyword = strtok(srcline, " \t"); |
| 971 | CleanupStrcxx . . $ CleanupStr(55abe9014c6d0e39).(command, srcline, sizeof(command)); |
| 972 | CleanupStrcxx . . $ CleanupStr(55abe9014c6d0e39).(operand, srcline + strlen(command) + 1, sizeof(operand)); |
| 973 | if (strlen(command) && indesc) |
| 974 | indesc = 0; |
| 975 | if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(command, "NAME")) { |
| 976 | strncpy(msn->namecxx . . $ tMission#name., operand, MSN_NAMELENcxx . . $ `Descent3/descent.h:181:9`! - 1); |
| 977 | } else if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(command, "MULTI")) { |
| 978 | if (stricmpcxx . . $ `linux/linux_fix.h:43:9`!("no", operand) == 0) |
| 979 | msn->multiplayablecxx . . $ tMission#multiplayable. = false; |
| 980 | } else if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(command, "SINGLE")) { |
| 981 | if (stricmpcxx . . $ `linux/linux_fix.h:43:9`!("no", operand) == 0) |
| 982 | msn->singleplayablecxx . . $ tMission#singleplayable. = false; |
| 983 | } else if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(command, "TRAINER")) { |
| 984 | if (curlvlnum == 0) { |
| 985 | msn->training_missioncxx . . $ tMission#training_mission. = true; |
| 986 | } else { |
| 987 | strcpy(errtext, TXT_MSN_MSNCOMMANDcxx . . $ `Descent3/stringtable.h:813:9`!); |
| 988 | goto msnfile_error; |
| 989 | } |
| 990 | } else if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(command, "AUTHOR")) { |
| 991 | strncpy(msn->authorcxx . . $ tMission#author., operand, MSN_NAMELENcxx . . $ `Descent3/descent.h:181:9`! - 1); |
| 992 | } else if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(command, "KEYWORDS")) { |
| 993 | // Don't do anything with this |
| 994 | } else if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(command, "DESCRIPTION") || indesc) { |
| 995 | // multi-line descriptions require the strcat. the initial |
| 996 | // strings should be empty for this to work. |
| 997 | strcat(msn->desccxx . . $ tMission#desc., operand); |
| 998 | if (indesc) |
| 999 | strcat(msn->desccxx . . $ tMission#desc., "\n"); |
| 1000 | indesc = 1; // this is a multiline command |
| 1001 | } else if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(command, "URL")) { |
| 1002 | if (curlvlnum != 0) { |
| 1003 | strcpy(errtext, TXT_MSN_LVLCOMMANDcxx . . $ `Descent3/stringtable.h:814:9`!); |
| 1004 | goto msnfile_error; |
| 1005 | } else { |
| 1006 | for (int a = 0; a < MAX_MISSION_URL_COUNTcxx . . $ `Descent3/mission_download.h:48:9`!; a++) { |
| 1007 | if (Net_msn_URLscxx . . $ Net_msn_URLs..URLcxx . . $ msn_urls#URL.[a][0] == '\0') { |
| 1008 | strncpy(Net_msn_URLscxx . . $ Net_msn_URLs..URLcxx . . $ msn_urls#URL.[a], operand, MAX_MISSION_URL_LENcxx . . $ `Descent3/mission_download.h:47:9`! - 1); |
| 1009 | Net_msn_URLscxx . . $ Net_msn_URLs..URLcxx . . $ msn_urls#URL.[a][MAX_MISSION_URL_LENcxx . . $ `Descent3/mission_download.h:47:9`! - 1] = '\0'; |
| 1010 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Found a Mission URL: %s\n", operand); |
| 1011 | break; |
| 1012 | } |
| 1013 | } |
| 1014 | } |
| 1015 | } else if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(command, "SHIP")) { |
| 1016 | // there is a different default ship |
| 1017 | if (curlvlnum != 0) { |
| 1018 | strcpy(errtext, TXT_MSN_LVLCOMMANDcxx . . $ `Descent3/stringtable.h:814:9`!); |
| 1019 | goto msnfile_error; |
| 1020 | } else { |
| 1021 | int ship_index = FindShipNamecxx . . $ FindShipName(5c4306d8553b3696).(operand); |
| 1022 | if (ship_index != -1) { |
| 1023 | // ok the ship exists, make this guy the new default ship |
| 1024 | PlayerResetShipPermissionscxx . . $ PlayerResetShipPermissions(9609253e83e89946).(-1, false); |
| 1025 | PlayerSetShipPermissioncxx . . $ PlayerSetShipPermission(fb2bb0cf4ad3de37).(-1, operand, true); |
| 1026 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "MAKING %s THE NEW DEFAULT SHIP!\n", operand); |
| 1027 | } else { |
| 1028 | Int3cxx . . $ `misc/pserror.h:247:9`!(); |
| 1029 | } |
| 1030 | } |
| 1031 | } else if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(command, "EMAIL")) { |
| 1032 | if (curlvlnum != 0) { |
| 1033 | strcpy(errtext, TXT_MSN_LVLCOMMANDcxx . . $ `Descent3/stringtable.h:814:9`!); |
| 1034 | goto msnfile_error; |
| 1035 | } else |
| 1036 | strncpy(msn->emailcxx . . $ tMission#email., operand, MSN_URLLENcxx . . $ MSN_URLLEN. - 1); |
| 1037 | } else if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(command, "SCORE")) { |
| 1038 | if (curlvlnum == 0) { |
| 1039 | strcpy(errtext, TXT_MSN_LVLCOMMANDcxx . . $ `Descent3/stringtable.h:814:9`!); |
| 1040 | goto msnfile_error; |
| 1041 | } else { |
| 1042 | lvls[curlvlnum - 1].flagscxx . . $ tLevelNode#flags. |= LVLFLAG_SCOREcxx . . $ LVLFLAG_SCORE.; |
| 1043 | lvls[curlvlnum - 1].scorecxx . . $ tLevelNode#score. = mem_strdupcxx . . $ `mem/mem.h:81:9`!(operand); |
| 1044 | if (!lvls[curlvlnum - 1].scorecxx . . $ tLevelNode#score.) |
| 1045 | goto fatal_error; |
| 1046 | } |
| 1047 | } else if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(command, "PROGRESS")) { |
| 1048 | if (curlvlnum == 0) { |
| 1049 | strcpy(errtext, TXT_MSN_LVLCOMMANDcxx . . $ `Descent3/stringtable.h:814:9`!); |
| 1050 | goto msnfile_error; |
| 1051 | } else { |
| 1052 | lvls[curlvlnum - 1].progresscxx . . $ tLevelNode#progress. = mem_strdupcxx . . $ `mem/mem.h:81:9`!(operand); |
| 1053 | if (!lvls[curlvlnum - 1].progresscxx . . $ tLevelNode#progress.) |
| 1054 | goto fatal_error; |
| 1055 | } |
| 1056 | } else if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(command, "HOG")) { |
| 1057 | if (curlvlnum == 0) { |
| 1058 | msn->hogcxx . . $ tMission#hog. = mem_strdupcxx . . $ `mem/mem.h:81:9`!(operand); |
| 1059 | if (!msn->hogcxx . . $ tMission#hog.) |
| 1060 | goto fatal_error; |
| 1061 | } else { |
| 1062 | lvls[curlvlnum - 1].flagscxx . . $ tLevelNode#flags. |= LVLFLAG_SPECIALHOGcxx . . $ LVLFLAG_SPECIALHOG.; |
| 1063 | if (!(lvls[curlvlnum - 1].hogcxx . . $ tLevelNode#hog. = mem_strdupcxx . . $ `mem/mem.h:81:9`!(operand))) |
| 1064 | goto fatal_error; |
| 1065 | } |
| 1066 | } else if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(command, "NUMLEVELS")) { |
| 1067 | if (curlvlnum != 0) { |
| 1068 | strcpy(errtext, TXT_MSN_LVLCOMMANDcxx . . $ `Descent3/stringtable.h:814:9`!); |
| 1069 | goto msnfile_error; |
| 1070 | } else { |
| 1071 | // get number of levels |
| 1072 | int value = atoi(operand); |
| 1073 | if (value == 0) { |
| 1074 | strcpy(errtext, TXT_MSN_LVLNUMINVALIDcxx . . $ `Descent3/stringtable.h:816:9`!); |
| 1075 | goto msnfile_error; |
| 1076 | } |
| 1077 | lvls = (tLevelNodecxx . . $ tLevelNode# *)mem_malloccxx . . $ `mem/mem.h:79:9`!(sizeof(tLevelNode) * value); |
| 1078 | memset(lvls, 0, sizeof(tLevelNodecxx . . $ tLevelNode#) * value); |
| 1079 | numlevels = value; |
| 1080 | } |
| 1081 | } else if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(command, "LEVEL")) { |
| 1082 | // first check if number of level is greater than num_levels |
| 1083 | if ((curlvlnum == numlevels) && (numlevels != -1)) { |
| 1084 | strcpy(errtext, TXT_MSN_NUMLVLSINVALIDcxx . . $ `Descent3/stringtable.h:815:9`!); |
| 1085 | goto msnfile_error; |
| 1086 | } |
| 1087 | curlvlnum = atoi(operand); |
| 1088 | if (curlvlnum == 0) { |
| 1089 | strcpy(errtext, TXT_MSN_LVLNUMINVALIDcxx . . $ `Descent3/stringtable.h:816:9`!); |
| 1090 | goto msnfile_error; |
| 1091 | } else if (curlvlnum > numlevels || curlvlnum < 0) { |
| 1092 | strcpy(errtext, TXT_MSN_LVLNUMINVALIDcxx . . $ `Descent3/stringtable.h:816:9`!); |
| 1093 | goto msnfile_error; |
| 1094 | } |
| 1095 | } else if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(command, "INTROMOVIE")) { |
| 1096 | if (curlvlnum == 0) { |
| 1097 | strcpy(errtext, TXT_MSN_LVLCOMMANDcxx . . $ `Descent3/stringtable.h:814:9`!); |
| 1098 | goto msnfile_error; |
| 1099 | } else { |
| 1100 | lvls[curlvlnum - 1].flagscxx . . $ tLevelNode#flags. |= LVLFLAG_STARTMOVIEcxx . . $ LVLFLAG_STARTMOVIE.; |
| 1101 | if (!(lvls[curlvlnum - 1].movienamecxx . . $ tLevelNode#moviename. = mem_strdupcxx . . $ `mem/mem.h:81:9`!(operand))) |
| 1102 | goto fatal_error; |
| 1103 | } |
| 1104 | } else if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(command, "INTRODEFAULT")) { |
| 1105 | if (curlvlnum == 0) { |
| 1106 | strcpy(errtext, TXT_MSN_LVLCOMMANDcxx . . $ `Descent3/stringtable.h:814:9`!); |
| 1107 | goto msnfile_error; |
| 1108 | } else if (!Descent_overrided_introcxx . . $ Descent_overrided_intro.) { |
| 1109 | lvls[curlvlnum - 1].flagscxx . . $ tLevelNode#flags. |= LVLFLAG_STARTMOVIEcxx . . $ LVLFLAG_STARTMOVIE.; |
| 1110 | if (!(lvls[curlvlnum - 1].movienamecxx . . $ tLevelNode#moviename. = mem_strdupcxx . . $ `mem/mem.h:81:9`!(operand))) |
| 1111 | goto fatal_error; |
| 1112 | } |
| 1113 | } else if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(command, "ENDMOVIE")) { |
| 1114 | if (curlvlnum == 0) { |
| 1115 | strcpy(errtext, TXT_MSN_LVLCOMMANDcxx . . $ `Descent3/stringtable.h:814:9`!); |
| 1116 | goto msnfile_error; |
| 1117 | } else { |
| 1118 | lvls[curlvlnum - 1].flagscxx . . $ tLevelNode#flags. |= LVLFLAG_ENDMOVIEcxx . . $ LVLFLAG_ENDMOVIE.; |
| 1119 | if (!(lvls[curlvlnum - 1].endmoviecxx . . $ tLevelNode#endmovie. = mem_strdupcxx . . $ `mem/mem.h:81:9`!(operand))) |
| 1120 | goto fatal_error; |
| 1121 | } |
| 1122 | } else if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(command, "MINE")) { |
| 1123 | if (curlvlnum == 0) { |
| 1124 | strcpy(errtext, TXT_MSN_LVLCOMMANDcxx . . $ `Descent3/stringtable.h:814:9`!); |
| 1125 | goto msnfile_error; |
| 1126 | } else { |
| 1127 | if (!(lvls[curlvlnum - 1].filenamecxx . . $ tLevelNode#filename. = mem_strdupcxx . . $ `mem/mem.h:81:9`!(operand))) |
| 1128 | goto fatal_error; |
| 1129 | } |
| 1130 | } else if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(command, "SECRET")) { |
| 1131 | if (curlvlnum == 0) { |
| 1132 | strcpy(errtext, TXT_MSN_LVLCOMMANDcxx . . $ `Descent3/stringtable.h:814:9`!); |
| 1133 | goto msnfile_error; |
| 1134 | } else { |
| 1135 | lvls[curlvlnum - 1].flagscxx . . $ tLevelNode#flags. |= LVLFLAG_SPAWNSECRETcxx . . $ LVLFLAG_SPAWNSECRET.; |
| 1136 | lvls[curlvlnum - 1].secretlvlcxx . . $ tLevelNode#secretlvl. = atoi(operand); |
| 1137 | } |
| 1138 | } else if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(command, "BRIEFING")) { |
| 1139 | if (curlvlnum == 0) { |
| 1140 | strcpy(errtext, TXT_MSN_LVLCOMMANDcxx . . $ `Descent3/stringtable.h:814:9`!); |
| 1141 | goto msnfile_error; |
| 1142 | } else { |
| 1143 | lvls[curlvlnum - 1].flagscxx . . $ tLevelNode#flags. |= LVLFLAG_BRIEFINGcxx . . $ LVLFLAG_BRIEFING.; |
| 1144 | if (!(lvls[curlvlnum - 1].briefnamecxx . . $ tLevelNode#briefname. = mem_strdupcxx . . $ `mem/mem.h:81:9`!(operand))) |
| 1145 | goto fatal_error; |
| 1146 | } |
| 1147 | } else if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(command, "BRANCH")) { |
| 1148 | // first check if number of level is greater than num_levels |
| 1149 | int lvlnum; |
| 1150 | if (curlvlnum == 0) { |
| 1151 | strcpy(errtext, TXT_MSN_LVLCOMMANDcxx . . $ `Descent3/stringtable.h:814:9`!); |
| 1152 | goto msnfile_error; |
| 1153 | } |
| 1154 | lvlnum = atoi(operand); |
| 1155 | if (lvlnum == 0 || lvlnum > numlevels) { |
| 1156 | strcpy(errtext, TXT_MSN_LVLNUMINVALIDcxx . . $ `Descent3/stringtable.h:816:9`!); |
| 1157 | goto msnfile_error; |
| 1158 | } |
| 1159 | lvls[curlvlnum - 1].flagscxx . . $ tLevelNode#flags. |= LVLFLAG_BRANCHcxx . . $ LVLFLAG_BRANCH.; |
| 1160 | lvls[curlvlnum - 1].lvlbranch0cxx . . $ tLevelNode#lvlbranch0. = lvlnum; |
| 1161 | } else if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(command, "ENDMISSION")) { |
| 1162 | if (curlvlnum == 0) { |
| 1163 | strcpy(errtext, TXT_MSN_LVLCOMMANDcxx . . $ `Descent3/stringtable.h:814:9`!); |
| 1164 | goto msnfile_error; |
| 1165 | } else { |
| 1166 | lvls[curlvlnum - 1].flagscxx . . $ tLevelNode#flags. |= LVLFLAG_FINALcxx . . $ LVLFLAG_FINAL.; |
| 1167 | } |
| 1168 | } else { |
| 1169 | snprintf(errtext, sizeof(errtext), TXT_MSN_ILLEGALCMDcxx . . $ `Descent3/stringtable.h:817:9`!, command); |
| 1170 | goto msnfile_error; |
| 1171 | } |
| 1172 | } |
| 1173 | srclinenum++; |
| 1174 | } |
| 1175 | // set up current mission (movies are already set above) |
| 1176 | msn->cur_levelcxx . . $ tMission#cur_level. = 1; |
| 1177 | msn->num_levelscxx . . $ tMission#num_levels. = numlevels; |
| 1178 | msn->levelscxx . . $ tMission#levels. = lvls; |
| 1179 | msn->filenamecxx . . $ tMission#filename. = mem_strdupcxx . . $ `mem/mem.h:81:9`!(mission); |
| 1180 | msn->game_state_flagscxx . . $ tMission#game_state_flags. = 0; |
| 1181 | strcpy(Net_msn_URLscxx . . $ Net_msn_URLs..msnnamecxx . . $ msn_urls#msnname., mission); |
| 1182 | res = true; // everthing is ok. |
| 1183 | // if error, print it out, else end. |
| 1184 | msnfile_error: |
| 1185 | if (!res) { |
| 1186 | char str_text[128]; |
| 1187 | snprintf(str_text, sizeof(str_text), "%s\nline %d.", errtext, srclinenum); |
| 1188 | if (!Dedicated_servercxx . . $ Dedicated_server.) { |
| 1189 | DoMessageBoxcxx . . $ DoMessageBox(dcc99837539e9edc).(TXT_ERRORcxx . . $ `Descent3/stringtable.h:165:9`!, str_text, MSGBOX_OKcxx . . $ `Descent3/newui_core.h:78:9`!); |
| 1190 | } else { |
| 1191 | PrintDedicatedMessagecxx . . $ PrintDedicatedMessage(326aeb464d16410c).("%s: %s\n", TXT_ERRORcxx . . $ `Descent3/stringtable.h:165:9`!, str_text); |
| 1192 | } |
| 1193 | if (lvls) |
| 1194 | mem_freecxx . . $ `mem/mem.h:80:9`!(lvls); |
| 1195 | } |
| 1196 | if (fp) |
| 1197 | cfclosecxx . . $ cfclose(3639e799710acb68).(fp); |
| 1198 | // load default script here. |
| 1199 | if (!InitMissionScriptcxx . . $ InitMissionScript(c9857a73d68e59ba).()) { |
| 1200 | return false; |
| 1201 | } |
| 1202 | return res; |
| 1203 | fatal_error: |
| 1204 | mem_errorcxx . . $ `mem/mem.h:97:9`!(); |
| 1205 | return false; |
| 1206 | #endif |
| 1207 | return false; |
| 1208 | } |
| 1209 | void FreeMissioncxx . . $ FreeMission(49f6e7a06ebc5aa8).() { |
| 1210 | // Free up mission script |
| 1211 | int i; //,j; |
| 1212 | // close MN3 file if there is one. |
| 1213 | mn3_Closecxx . . $ mn3_Close(49f6e7a06ebc5aa8).(); |
| 1214 | // Tell Osiris to shutdown the Osiris Mission Memory System, freeing all memory |
| 1215 | Osiris_CloseOMMScxx . . $ Osiris_CloseOMMS(49f6e7a06ebc5aa8).(); |
| 1216 | if (Current_missioncxx . . $ Current_mission..levelscxx . . $ tMission#levels.) { |
| 1217 | // free up any data allocated per level node. |
| 1218 | for (i = 0; i < Current_missioncxx . . $ Current_mission..num_levelscxx . . $ tMission#num_levels.; i++) { |
| 1219 | if (Current_missioncxx . . $ Current_mission..levelscxx . . $ tMission#levels.[i].filenamecxx . . $ tLevelNode#filename.) |
| 1220 | mem_freecxx . . $ `mem/mem.h:80:9`!(Current_mission.levels[i].filename); |
| 1221 | if (Current_missioncxx . . $ Current_mission..levelscxx . . $ tMission#levels.[i].briefnamecxx . . $ tLevelNode#briefname.) |
| 1222 | mem_freecxx . . $ `mem/mem.h:80:9`!(Current_mission.levels[i].briefname); |
| 1223 | if (Current_missioncxx . . $ Current_mission..levelscxx . . $ tMission#levels.[i].hogcxx . . $ tLevelNode#hog.) |
| 1224 | mem_freecxx . . $ `mem/mem.h:80:9`!(Current_mission.levels[i].hog); |
| 1225 | if (Current_missioncxx . . $ Current_mission..levelscxx . . $ tMission#levels.[i].movienamecxx . . $ tLevelNode#moviename.) |
| 1226 | mem_freecxx . . $ `mem/mem.h:80:9`!(Current_mission.levels[i].moviename); |
| 1227 | if (Current_missioncxx . . $ Current_mission..levelscxx . . $ tMission#levels.[i].endmoviecxx . . $ tLevelNode#endmovie.) |
| 1228 | mem_freecxx . . $ `mem/mem.h:80:9`!(Current_mission.levels[i].endmovie); |
| 1229 | if (Current_missioncxx . . $ Current_mission..levelscxx . . $ tMission#levels.[i].scorecxx . . $ tLevelNode#score.) |
| 1230 | mem_freecxx . . $ `mem/mem.h:80:9`!(Current_mission.levels[i].score); |
| 1231 | if (Current_missioncxx . . $ Current_mission..levelscxx . . $ tMission#levels.[i].progresscxx . . $ tLevelNode#progress.) |
| 1232 | mem_freecxx . . $ `mem/mem.h:80:9`!(Current_mission.levels[i].progress); |
| 1233 | } |
| 1234 | mem_freecxx . . $ `mem/mem.h:80:9`!(Current_mission.levels); |
| 1235 | Current_missioncxx . . $ Current_mission..levelscxx . . $ tMission#levels. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1236 | } |
| 1237 | //@@ if (Current_mission.d3xmod) { |
| 1238 | //@@ D3XFreeProgram(Current_mission.d3xmod); |
| 1239 | //@@ Current_mission.d3xmod = NULL; |
| 1240 | //@@ } |
| 1241 | if (Current_missioncxx . . $ Current_mission..hogcxx . . $ tMission#hog.) |
| 1242 | mem_freecxx . . $ `mem/mem.h:80:9`!(Current_mission.hog); |
| 1243 | if (Current_missioncxx . . $ Current_mission..filenamecxx . . $ tMission#filename.) { |
| 1244 | // these DON't USE mem_free since we use _strdup, which doesn't use our memory routines. |
| 1245 | mem_freecxx . . $ `mem/mem.h:80:9`!(Current_mission.filename); |
| 1246 | Current_missioncxx . . $ Current_mission..filenamecxx . . $ tMission#filename. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1247 | } |
| 1248 | Current_missioncxx . . $ Current_mission..hogcxx . . $ tMission#hog. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1249 | Current_levelcxx . . $ Current_level. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1250 | } |
| 1251 | #include "localization.h"cxx . . $ `<file>/Descent3/localization.h`/ |
| 1252 | #include "levelgoal.h"cxx . . $ `<file>/Descent3/levelgoal.h`/ |
| 1253 | // Load the text (goal strings) for a level |
| 1254 | void LoadLevelTextcxx . . $ LoadLevelText(85c52e162fed56f9).(const char *level_filename) { |
| 1255 | char pathname[_MAX_FNAMEcxx . . $ `linux/linux_fix.h:35:9`!], filename[_MAX_FNAMEcxx . . $ `linux/linux_fix.h:35:9`!]; |
| 1256 | int n_strings; |
| 1257 | ddio_SplitPathcxx . . $ ddio_SplitPath(b05ba7ab99603c07).(level_filename, pathname, filename, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 1258 | strcat(pathname, filename); |
| 1259 | strcat(pathname, ".str"); |
| 1260 | char **goal_strings; |
| 1261 | if (CreateStringTablecxx . . $ CreateStringTable(c1b497ce97e7b78).(pathname, &goal_strings, &n_strings)) { |
| 1262 | int n_goals = Level_goalscxx . . $ Level_goals..GetNumGoalscxx . . $ levelgoals#GetNumGoals(b126dc7c1de90089).(); |
| 1263 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(n_strings == (n_goals * 3)); |
| 1264 | for (int i = 0; i < n_goals; i++) { |
| 1265 | Level_goalscxx . . $ Level_goals..GoalSetNamecxx . . $ levelgoals#GoalSetName(ceb9eed3194142b2).(i, goal_strings[i * 3]); |
| 1266 | Level_goalscxx . . $ Level_goals..GoalSetItemNamecxx . . $ levelgoals#GoalSetItemName(ceb9eed3194142b2).(i, goal_strings[i * 3 + 1]); |
| 1267 | Level_goalscxx . . $ Level_goals..GoalSetDesccxx . . $ levelgoals#GoalSetDesc(ceb9eed3194142b2).(i, goal_strings[i * 3 + 2]); |
| 1268 | } |
| 1269 | DestroyStringTablecxx . . $ DestroyStringTable(a50bc8ce1fe710a2).(goal_strings, n_strings); |
| 1270 | } |
| 1271 | } |
| 1272 | |
| 1273 | /* loads a level and sets it as current level in mission |
| 1274 | */ |
| 1275 | bool LoadMissionLevelcxx . . $ LoadMissionLevel(83c267b20bac841a).(int level) { |
| 1276 | Hud_show_controlscxx . . $ Hud_show_controls. = false; |
| 1277 | LoadLevelProgresscxx . . $ LoadLevelProgress(818fb24820cdd2d5).(LOAD_PROGRESS_STARTcxx . . $ `Descent3/Mission.h:174:9`!, 0); |
| 1278 | if (!LoadLevelcxx . . $ LoadLevel(bfcae8e6466ff2ca).(Current_missioncxx . . $ Current_mission..levelscxx . . $ tMission#levels.[level - 1].filenamecxx . . $ tLevelNode#filename., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)) { |
| 1279 | char buf[128]; |
| 1280 | snprintf(buf, sizeof(buf), TXT_MSNERRORcxx . . $ `Descent3/stringtable.h:175:9`!, Current_missioncxx . . $ Current_mission..levelscxx . . $ tMission#levels.[level - 1].filenamecxx . . $ tLevelNode#filename.); |
| 1281 | SetUICallbackcxx . . $ SetUICallback(964b12a25712bdc3).(DEFAULT_UICALLBACKcxx . . $ `Descent3/newui_core.h:125:9`!); |
| 1282 | DoMessageBoxcxx . . $ DoMessageBox(dcc99837539e9edc).(TXT_ERRORcxx . . $ `Descent3/stringtable.h:165:9`!, buf, MSGBOX_OKcxx . . $ `Descent3/newui_core.h:78:9`!); |
| 1283 | LoadLevelProgresscxx . . $ LoadLevelProgress(818fb24820cdd2d5).(LOAD_PROGRESS_DONEcxx . . $ `Descent3/Mission.h:178:9`!, 0); |
| 1284 | return false; |
| 1285 | } |
| 1286 | // Test to see if levels are valid |
| 1287 | bool boa = true, terrain = true; |
| 1288 | char str[255]; |
| 1289 | |
| 1290 | if (BOAGetMineChecksumcxx . . $ BOAGetMineChecksum(b126dc7c1de90089).() != BOA_vis_checksumcxx . . $ BOA_vis_checksum.) |
| 1291 | boa = false; |
| 1292 | if (GetTerrainGeometryChecksumcxx . . $ GetTerrainGeometryChecksum(b126dc7c1de90089).() != Terrain_checksumcxx . . $ Terrain_checksum.) |
| 1293 | terrain = false; |
| 1294 | |
| 1295 | // JC: This isn't going to be fixed for a while, so silence the error |
| 1296 | /* |
| 1297 | if (!boa) { |
| 1298 | snprintf(str, sizeof(str), "BOA NOT VALID! %s", terrain ? "" : "TERRAINOCC NOT VALID!"); |
| 1299 | ShowProgressScreen(str, NULL, true); |
| 1300 | Sleep(2000); |
| 1301 | } */ |
| 1302 | |
| 1303 | LoadLevelTextcxx . . $ LoadLevelText(85c52e162fed56f9).(Current_missioncxx . . $ Current_mission..levelscxx . . $ tMission#levels.[level - 1].filenamecxx . . $ tLevelNode#filename.); |
| 1304 | |
| 1305 | return true; |
| 1306 | } |
| 1307 | #define LOADBAR_Xcxx . . $ `Descent3/Mission.cpp:1307:9`! (16 * (float)Max_window_w / (float)FIXED_SCREEN_WIDTHcxx . . $ `lib/grdefs.h:65:9`!) |
| 1308 | #define LOADBAR_Y1cxx . . $ `Descent3/Mission.cpp:1308:9`! (376 * (float)Max_window_h / (float)FIXED_SCREEN_HEIGHTcxx . . $ `lib/grdefs.h:66:9`!) |
| 1309 | #define LOADBAR_Y2cxx . . $ `Descent3/Mission.cpp:1309:9`! (440 * (float)Max_window_h / (float)FIXED_SCREEN_HEIGHTcxx . . $ `lib/grdefs.h:66:9`!) |
| 1310 | #define LOADBAR_Wcxx . . $ `Descent3/Mission.cpp:1310:9`! (260 * (float)Max_window_w / (float)FIXED_SCREEN_WIDTHcxx . . $ `lib/grdefs.h:65:9`!) |
| 1311 | #define LOADBAR_Hcxx . . $ `Descent3/Mission.cpp:1311:9`! (22 * (float)Max_window_h / (float)FIXED_SCREEN_HEIGHTcxx . . $ `lib/grdefs.h:66:9`!) |
| 1312 | #define N_LOAD_MSGScxx . . $ `Descent3/Mission.cpp:1312:9`! 12 |
| 1313 | bool started_pagecxx . . $ started_page. = 0; |
| 1314 | /* |
| 1315 | $$TABLE_GAMEFILE "tunnelload.ogf" |
| 1316 | */ |
| 1317 | bool Progress_screen_loadedcxx . . $ Progress_screen_loaded. = false; |
| 1318 | void LoadLevelProgresscxx . . $ LoadLevelProgress(818fb24820cdd2d5).(int step, float percent, const char *chunk) { |
| 1319 | static tLargeBitmapcxx . . $ tLargeBitmap# level_bmp; |
| 1320 | static bool level_bmp_loaded = false; |
| 1321 | static int dedicated_last_string_len = -1; |
| 1322 | float lvl_percent_loaded = 0; |
| 1323 | float pag_percent_loaded = 0; |
| 1324 | int i; |
| 1325 | static int n_text_msgs = 0; |
| 1326 | static char text_msgs[N_LOAD_MSGScxx . . $ `Descent3/Mission.cpp:1312:9`!][80]; |
| 1327 | char str[80]; |
| 1328 | // If we're loading a level, send out a heartbeat |
| 1329 | if ((Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!)) { |
| 1330 | MultiSendHeartbeatcxx . . $ MultiSendHeartbeat(49f6e7a06ebc5aa8).(); |
| 1331 | } |
| 1332 | if (percent > 1.0f) { |
| 1333 | percent = 1.0f; |
| 1334 | } else if (percent < 0.0f) { |
| 1335 | percent = 0.0f; |
| 1336 | } |
| 1337 | if ((!Progress_screen_loadedcxx . . $ Progress_screen_loaded.) && (step != LOAD_PROGRESS_STARTcxx . . $ `Descent3/Mission.h:174:9`!)) |
| 1338 | return; |
| 1339 | switch (step) { |
| 1340 | case LOAD_PROGRESS_STARTcxx . . $ `Descent3/Mission.h:174:9`!: { |
| 1341 | lvl_percent_loaded = 0.0f; |
| 1342 | pag_percent_loaded = 0.0f; |
| 1343 | dedicated_last_string_len = -1; |
| 1344 | const char *p = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 1345 | if ((!(Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!)) && (!Current_missioncxx . . $ Current_mission..levelscxx . . $ tMission#levels.[Current_missioncxx . . $ Current_mission..cur_levelcxx . . $ tMission#cur_level. - 1].progresscxx . . $ tLevelNode#progress.)) { |
| 1346 | p = "tunnelload.ogf"; |
| 1347 | } else { |
| 1348 | p = Current_missioncxx . . $ Current_mission..levelscxx . . $ tMission#levels.[Current_missioncxx . . $ Current_mission..cur_levelcxx . . $ tMission#cur_level. - 1].progresscxx . . $ tLevelNode#progress.; |
| 1349 | } |
| 1350 | |
| 1351 | if (p) { |
| 1352 | if (LoadLargeBitmapcxx . . $ LoadLargeBitmap(df64d18e3909f364).(IGNORE_TABLEcxx . . $ `lib/manage_external.h:54:9`!(p), &level_bmp)) { |
| 1353 | SetScreenModecxx . . $ SetScreenMode(918ebd27a9ddbad3).(SM_MENUcxx . . $ SM_MENU.); |
| 1354 | level_bmp_loaded = true; |
| 1355 | n_text_msgs = 0; |
| 1356 | } |
| 1357 | } |
| 1358 | /* |
| 1359 | else |
| 1360 | { |
| 1361 | ShowProgressScreen (TXT_LOADINGLEVEL); |
| 1362 | } |
| 1363 | */ |
| 1364 | Progress_screen_loadedcxx . . $ Progress_screen_loaded. = true; |
| 1365 | return; |
| 1366 | } break; |
| 1367 | case LOAD_PROGRESS_LOADING_LEVELcxx . . $ `Descent3/Mission.h:175:9`!: { |
| 1368 | lvl_percent_loaded = percent; |
| 1369 | } break; |
| 1370 | case LOAD_PROGRESS_PAGING_DATAcxx . . $ `Descent3/Mission.h:176:9`!: { |
| 1371 | lvl_percent_loaded = 1.0f; |
| 1372 | pag_percent_loaded = percent; |
| 1373 | } break; |
| 1374 | case LOAD_PROGRESS_PREPAREcxx . . $ `Descent3/Mission.h:177:9`!: |
| 1375 | if (Dedicated_servercxx . . $ Dedicated_server.) { |
| 1376 | PrintDedicatedMessagecxx . . $ PrintDedicatedMessage(326aeb464d16410c).("\n"); |
| 1377 | } |
| 1378 | lvl_percent_loaded = 1.0f; |
| 1379 | pag_percent_loaded = 1.0f; |
| 1380 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Prepare for Descent goes here...\n"); |
| 1381 | // ShowProgressScreen(TXT_PREPARE_FOR_DESCENT,NULL,true); |
| 1382 | // return; |
| 1383 | break; |
| 1384 | case LOAD_PROGRESS_DONEcxx . . $ `Descent3/Mission.h:178:9`!: { |
| 1385 | if (level_bmp_loaded) { |
| 1386 | // print out final message |
| 1387 | FreeLargeBitmapcxx . . $ FreeLargeBitmap(99797d0c91a30e0c).(&level_bmp); |
| 1388 | level_bmp_loaded = false; |
| 1389 | } |
| 1390 | Progress_screen_loadedcxx . . $ Progress_screen_loaded. = false; |
| 1391 | if (Dedicated_servercxx . . $ Dedicated_server.) { |
| 1392 | PrintDedicatedMessagecxx . . $ PrintDedicatedMessage(326aeb464d16410c).("\n"); |
| 1393 | } |
| 1394 | return; |
| 1395 | } break; |
| 1396 | default: |
| 1397 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Unknown step in LoadLevelProgress()\n"); |
| 1398 | Int3cxx . . $ `misc/pserror.h:247:9`!(); |
| 1399 | } |
| 1400 | if (Dedicated_servercxx . . $ Dedicated_server.) { |
| 1401 | char tbuffer[512]; |
| 1402 | char tbuffer1[512]; |
| 1403 | nw_DoNetworkIdlecxx . . $ nw_DoNetworkIdle(49f6e7a06ebc5aa8).(); |
| 1404 | if (dedicated_last_string_len != -1) { |
| 1405 | memset(tbuffer, '\b', dedicated_last_string_len); |
| 1406 | tbuffer[dedicated_last_string_len] = '\0'; |
| 1407 | PrintDedicatedMessagecxx . . $ PrintDedicatedMessage(326aeb464d16410c).(tbuffer); |
| 1408 | } |
| 1409 | char levelname[100]; |
| 1410 | snprintf(levelname, sizeof(levelname), "%s level %d", Current_missioncxx . . $ Current_mission..namecxx . . $ tMission#name., Current_missioncxx . . $ Current_mission..cur_levelcxx . . $ tMission#cur_level.); |
| 1411 | if (lvl_percent_loaded < 1.0f) { |
| 1412 | snprintf(tbuffer1, sizeof(tbuffer1), TXT_DS_LEVELLOADSTATUScxx . . $ `Descent3/stringtable.h:599:9`!, levelname, lvl_percent_loaded * 100.0f); |
| 1413 | snprintf(tbuffer, sizeof(tbuffer), "%s%s", TXT_LOADINGLEVELcxx . . $ `Descent3/stringtable.h:128:9`!, tbuffer1); |
| 1414 | PrintDedicatedMessagecxx . . $ PrintDedicatedMessage(326aeb464d16410c).(tbuffer); |
| 1415 | dedicated_last_string_len = strlen(tbuffer); |
| 1416 | } else { |
| 1417 | snprintf(tbuffer1, sizeof(tbuffer1), TXT_DS_LEVELLOADSTATUScxx . . $ `Descent3/stringtable.h:599:9`!, levelname, pag_percent_loaded * 100.0f); |
| 1418 | snprintf(tbuffer, sizeof(tbuffer), "%s%s", TXT_LL_PAGINGDATAcxx . . $ `Descent3/stringtable.h:602:9`!, tbuffer1); |
| 1419 | PrintDedicatedMessagecxx . . $ PrintDedicatedMessage(326aeb464d16410c).(tbuffer); |
| 1420 | dedicated_last_string_len = strlen(tbuffer); |
| 1421 | } |
| 1422 | return; |
| 1423 | } |
| 1424 | StartFramecxx . . $ StartFrame(3285c9bef785d51c).(0, 0, Max_window_wcxx . . $ Max_window_w., Max_window_hcxx . . $ Max_window_h.); |
| 1425 | // do background. |
| 1426 | if (!level_bmp_loaded) { |
| 1427 | int text_height; |
| 1428 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(Current_level); |
| 1429 | rend_ClearScreencxx . . $ rend_ClearScreen(cb2f890c2fdad230).(GR_BLACKcxx . . $ GR_BLACK.); |
| 1430 | grtext_SetFontcxx . . $ grtext_SetFont(d4f767463ce0a6b3).(MENU_FONTcxx . . $ `Descent3/gamefont.h:106:9`!); |
| 1431 | text_height = grfont_GetHeightcxx . . $ grfont_GetHeight(7864480464b09eea).(MENU_FONTcxx . . $ `Descent3/gamefont.h:106:9`!); |
| 1432 | grtext_SetColorcxx . . $ grtext_SetColor(cb2f890c2fdad230).(GR_WHITEcxx . . $ GR_WHITE.); |
| 1433 | grtext_CenteredPrintfcxx . . $ grtext_CenteredPrintf(9514e36549094170).(0, Max_window_hcxx . . $ Max_window_h. / 2, TXT_LOADINGLEVELcxx . . $ `Descent3/stringtable.h:128:9`!); |
| 1434 | // grtext_CenteredPrintf(0, (Max_window_h/2)+(text_height*2), Current_level->name); |
| 1435 | } else { |
| 1436 | #ifdef STEALTH // DAJ |
| 1437 | rend_ClearScreen(GR_BLACK); |
| 1438 | #else |
| 1439 | DrawLargeBitmapcxx . . $ DrawLargeBitmap(a00f4917c93a8455).(&level_bmp, 0, 0, 1.0f); |
| 1440 | #endif |
| 1441 | // do relevent text. |
| 1442 | str[0] = 0; |
| 1443 | if (chunk) { |
| 1444 | if (strncmp(CHUNK_TERRAINcxx . . $ `Descent3/LoadLevel.h:458:9`!, chunk, strlen(CHUNK_TERRAINcxx . . $ `Descent3/LoadLevel.h:458:9`!)) == 0) |
| 1445 | strcpy(str, TXT_LL_TERRAINcxx . . $ `Descent3/stringtable.h:605:9`!); |
| 1446 | else if (strncmp(CHUNK_SCRIPT_CODEcxx . . $ `Descent3/LoadLevel.h:466:9`!, chunk, strlen(CHUNK_SCRIPT_CODEcxx . . $ `Descent3/LoadLevel.h:466:9`!)) == 0) |
| 1447 | strcpy(str, TXT_LL_SCRIPTLOADEDcxx . . $ `Descent3/stringtable.h:604:9`!); |
| 1448 | else if (strncmp(CHUNK_ROOMScxx . . $ `Descent3/LoadLevel.h:455:9`!, chunk, strlen(CHUNK_ROOMScxx . . $ `Descent3/LoadLevel.h:455:9`!)) == 0) |
| 1449 | strcpy(str, TXT_LL_ROOMSLOADEDcxx . . $ `Descent3/stringtable.h:600:9`!); |
| 1450 | else if (strncmp(CHUNK_OBJECTScxx . . $ `Descent3/LoadLevel.h:457:9`!, chunk, strlen(CHUNK_OBJECTScxx . . $ `Descent3/LoadLevel.h:457:9`!)) == 0) |
| 1451 | strcpy(str, TXT_LL_OBJECTSLOADEDcxx . . $ `Descent3/stringtable.h:601:9`!); |
| 1452 | } |
| 1453 | if (str[0]) { |
| 1454 | if (n_text_msgs == N_LOAD_MSGScxx . . $ `Descent3/Mission.cpp:1312:9`!) { |
| 1455 | for (i = 1; i < n_text_msgs; i++) { |
| 1456 | strcpy(text_msgs[i - 1], text_msgs[i]); |
| 1457 | } |
| 1458 | } else { |
| 1459 | n_text_msgs++; |
| 1460 | } |
| 1461 | strcpy(text_msgs[n_text_msgs - 1], str); |
| 1462 | } |
| 1463 | grtext_SetFontcxx . . $ grtext_SetFont(d4f767463ce0a6b3).(BRIEFING_FONTcxx . . $ `Descent3/gamefont.h:111:9`!); |
| 1464 | grtext_SetColorcxx . . $ grtext_SetColor(cb2f890c2fdad230).(GR_WHITEcxx . . $ GR_WHITE.); |
| 1465 | grtext_SetAlphacxx . . $ grtext_SetAlpha(ac50b47256ae7414).(230); |
| 1466 | for (i = 0; i < n_text_msgs; i++) { |
| 1467 | grtext_Printfcxx . . $ grtext_Printf(9514e36549094170).(14, 32 + (i * 15), text_msgs[i]); |
| 1468 | } |
| 1469 | } |
| 1470 | g3Pointcxx . . $ g3Point# *pntlist[4], points[4]; |
| 1471 | points[0].p3_sxcxx . . $ g3Point#p3_sx. = LOADBAR_Xcxx . . $ `Descent3/Mission.cpp:1307:9`!; |
| 1472 | points[0].p3_sycxx . . $ g3Point#p3_sy. = LOADBAR_Y1cxx . . $ `Descent3/Mission.cpp:1308:9`!; |
| 1473 | points[1].p3_sxcxx . . $ g3Point#p3_sx. = LOADBAR_Xcxx . . $ `Descent3/Mission.cpp:1307:9`! + LOADBAR_Wcxx . . $ `Descent3/Mission.cpp:1310:9`!; |
| 1474 | points[1].p3_sycxx . . $ g3Point#p3_sy. = LOADBAR_Y1cxx . . $ `Descent3/Mission.cpp:1308:9`!; |
| 1475 | points[2].p3_sxcxx . . $ g3Point#p3_sx. = LOADBAR_Xcxx . . $ `Descent3/Mission.cpp:1307:9`! + LOADBAR_Wcxx . . $ `Descent3/Mission.cpp:1310:9`!; |
| 1476 | points[2].p3_sycxx . . $ g3Point#p3_sy. = LOADBAR_Y1cxx . . $ `Descent3/Mission.cpp:1308:9`! + LOADBAR_Hcxx . . $ `Descent3/Mission.cpp:1311:9`!; |
| 1477 | points[3].p3_sxcxx . . $ g3Point#p3_sx. = LOADBAR_Xcxx . . $ `Descent3/Mission.cpp:1307:9`!; |
| 1478 | points[3].p3_sycxx . . $ g3Point#p3_sy. = LOADBAR_Y1cxx . . $ `Descent3/Mission.cpp:1308:9`! + LOADBAR_Hcxx . . $ `Descent3/Mission.cpp:1311:9`!; |
| 1479 | for (i = 0; i < 4; i++) { |
| 1480 | points[i].p3_zcxx . . $ `lib/3d.h:247:9`! = 0; |
| 1481 | points[i].p3_flagscxx . . $ g3Point#p3_flags. = PF_PROJECTEDcxx . . $ `lib/3d.h:214:9`!; |
| 1482 | pntlist[i] = &points[i]; |
| 1483 | } |
| 1484 | rend_SetZBufferStatecxx . . $ rend_SetZBufferState(4af4fd0e2b26c4ac).(0); |
| 1485 | rend_SetTextureTypecxx . . $ rend_SetTextureType(cccd9781d96f97ff).(TT_FLATcxx . . $ TT_FLAT.); |
| 1486 | rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_CONSTANTcxx . . $ `lib/renderer.h:400:9`!); |
| 1487 | rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_NONEcxx . . $ LS_NONE.); |
| 1488 | rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(230); |
| 1489 | if (!level_bmp_loaded) { |
| 1490 | rend_SetFlatColorcxx . . $ rend_SetFlatColor(cb2f890c2fdad230).(GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(192, 192, 192)); |
| 1491 | rend_DrawPolygon2Dcxx . . $ rend_DrawPolygon2D(1464bdba6025a51).(0, pntlist, 4); |
| 1492 | } |
| 1493 | |
| 1494 | pntlist[1]->p3_sxcxx . . $ g3Point#p3_sx. = LOADBAR_Xcxx . . $ `Descent3/Mission.cpp:1307:9`! + ((float)LOADBAR_Wcxx . . $ `Descent3/Mission.cpp:1310:9`! * lvl_percent_loaded); |
| 1495 | pntlist[2]->p3_sxcxx . . $ g3Point#p3_sx. = LOADBAR_Xcxx . . $ `Descent3/Mission.cpp:1307:9`! + ((float)LOADBAR_Wcxx . . $ `Descent3/Mission.cpp:1310:9`! * lvl_percent_loaded); |
| 1496 | |
| 1497 | rend_SetFlatColorcxx . . $ rend_SetFlatColor(cb2f890c2fdad230).(GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(166, 7, 7)); |
| 1498 | rend_DrawPolygon2Dcxx . . $ rend_DrawPolygon2D(1464bdba6025a51).(0, pntlist, 4); |
| 1499 | |
| 1500 | grtext_SetFontcxx . . $ grtext_SetFont(d4f767463ce0a6b3).(BRIEFING_FONTcxx . . $ `Descent3/gamefont.h:111:9`!); |
| 1501 | grtext_SetColorcxx . . $ grtext_SetColor(cb2f890c2fdad230).(GR_WHITEcxx . . $ GR_WHITE.); |
| 1502 | if (lvl_percent_loaded != 1.0) { |
| 1503 | strcpy(str, TXT_LOADINGLEVELcxx . . $ `Descent3/stringtable.h:128:9`!); |
| 1504 | } else { |
| 1505 | strcpy(str, TXT_DONEcxx . . $ `Descent3/stringtable.h:173:9`!); |
| 1506 | } |
| 1507 | grtext_Printfcxx . . $ grtext_Printf(9514e36549094170).(LOADBAR_Xcxx . . $ `Descent3/Mission.cpp:1307:9`! + (LOADBAR_Wcxx . . $ `Descent3/Mission.cpp:1310:9`! - grtext_GetLineWidthcxx . . $ `grtext/grtext.h:172:9`!(str)) / 2, |
| 1508 | LOADBAR_Y1cxx . . $ `Descent3/Mission.cpp:1308:9`! + (LOADBAR_Hcxx . . $ `Descent3/Mission.cpp:1311:9`! - grtext_GetHeightcxx . . $ `grtext/grtext.h:164:9`!(str)) / 2, str); |
| 1509 | points[0].p3_sxcxx . . $ g3Point#p3_sx. = LOADBAR_Xcxx . . $ `Descent3/Mission.cpp:1307:9`!; |
| 1510 | points[0].p3_sycxx . . $ g3Point#p3_sy. = LOADBAR_Y2cxx . . $ `Descent3/Mission.cpp:1309:9`!; |
| 1511 | points[1].p3_sxcxx . . $ g3Point#p3_sx. = LOADBAR_Xcxx . . $ `Descent3/Mission.cpp:1307:9`! + LOADBAR_Wcxx . . $ `Descent3/Mission.cpp:1310:9`!; |
| 1512 | points[1].p3_sycxx . . $ g3Point#p3_sy. = LOADBAR_Y2cxx . . $ `Descent3/Mission.cpp:1309:9`!; |
| 1513 | points[2].p3_sxcxx . . $ g3Point#p3_sx. = LOADBAR_Xcxx . . $ `Descent3/Mission.cpp:1307:9`! + LOADBAR_Wcxx . . $ `Descent3/Mission.cpp:1310:9`!; |
| 1514 | points[2].p3_sycxx . . $ g3Point#p3_sy. = LOADBAR_Y2cxx . . $ `Descent3/Mission.cpp:1309:9`! + LOADBAR_Hcxx . . $ `Descent3/Mission.cpp:1311:9`!; |
| 1515 | points[3].p3_sxcxx . . $ g3Point#p3_sx. = LOADBAR_Xcxx . . $ `Descent3/Mission.cpp:1307:9`!; |
| 1516 | points[3].p3_sycxx . . $ g3Point#p3_sy. = LOADBAR_Y2cxx . . $ `Descent3/Mission.cpp:1309:9`! + LOADBAR_Hcxx . . $ `Descent3/Mission.cpp:1311:9`!; |
| 1517 | for (i = 0; i < 4; i++) { |
| 1518 | points[i].p3_zcxx . . $ `lib/3d.h:247:9`! = 0; |
| 1519 | points[i].p3_flagscxx . . $ g3Point#p3_flags. = PF_PROJECTEDcxx . . $ `lib/3d.h:214:9`!; |
| 1520 | pntlist[i] = &points[i]; |
| 1521 | } |
| 1522 | rend_SetZBufferStatecxx . . $ rend_SetZBufferState(4af4fd0e2b26c4ac).(0); |
| 1523 | rend_SetTextureTypecxx . . $ rend_SetTextureType(cccd9781d96f97ff).(TT_FLATcxx . . $ TT_FLAT.); |
| 1524 | rend_SetAlphaTypecxx . . $ rend_SetAlphaType(4af4fd0e2b26c4ac).(AT_CONSTANTcxx . . $ `lib/renderer.h:400:9`!); |
| 1525 | rend_SetLightingcxx . . $ rend_SetLighting(e55526c9d3dd1656).(LS_NONEcxx . . $ LS_NONE.); |
| 1526 | rend_SetAlphaValuecxx . . $ rend_SetAlphaValue(ac50b47256ae7414).(230); |
| 1527 | if (!level_bmp_loaded) { |
| 1528 | rend_SetFlatColorcxx . . $ rend_SetFlatColor(cb2f890c2fdad230).(GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(192, 192, 192)); |
| 1529 | rend_DrawPolygon2Dcxx . . $ rend_DrawPolygon2D(1464bdba6025a51).(0, pntlist, 4); |
| 1530 | } |
| 1531 | |
| 1532 | pntlist[1]->p3_sxcxx . . $ g3Point#p3_sx. = LOADBAR_Xcxx . . $ `Descent3/Mission.cpp:1307:9`! + ((float)LOADBAR_Wcxx . . $ `Descent3/Mission.cpp:1310:9`! * pag_percent_loaded); |
| 1533 | pntlist[2]->p3_sxcxx . . $ g3Point#p3_sx. = LOADBAR_Xcxx . . $ `Descent3/Mission.cpp:1307:9`! + ((float)LOADBAR_Wcxx . . $ `Descent3/Mission.cpp:1310:9`! * pag_percent_loaded); |
| 1534 | |
| 1535 | rend_SetFlatColorcxx . . $ rend_SetFlatColor(cb2f890c2fdad230).(GR_RGBcxx . . $ GR_RGB(530956271a9518a5).(166, 7, 7)); |
| 1536 | rend_DrawPolygon2Dcxx . . $ rend_DrawPolygon2D(1464bdba6025a51).(0, pntlist, 4); |
| 1537 | |
| 1538 | grtext_SetFontcxx . . $ grtext_SetFont(d4f767463ce0a6b3).(BRIEFING_FONTcxx . . $ `Descent3/gamefont.h:111:9`!); |
| 1539 | grtext_SetColorcxx . . $ grtext_SetColor(cb2f890c2fdad230).(GR_WHITEcxx . . $ GR_WHITE.); |
| 1540 | if (pag_percent_loaded == 1.0) { |
| 1541 | strcpy(str, TXT_DONEcxx . . $ `Descent3/stringtable.h:173:9`!); |
| 1542 | } else { |
| 1543 | strcpy(str, TXT_LL_PAGINGDATAcxx . . $ `Descent3/stringtable.h:602:9`!); |
| 1544 | } |
| 1545 | |
| 1546 | if (pag_percent_loaded > 0.0) |
| 1547 | grtext_Printfcxx . . $ grtext_Printf(9514e36549094170).(LOADBAR_Xcxx . . $ `Descent3/Mission.cpp:1307:9`! + (LOADBAR_Wcxx . . $ `Descent3/Mission.cpp:1310:9`! - grtext_GetLineWidthcxx . . $ `grtext/grtext.h:172:9`!(str)) / 2, |
| 1548 | LOADBAR_Y2cxx . . $ `Descent3/Mission.cpp:1309:9`! + (LOADBAR_Hcxx . . $ `Descent3/Mission.cpp:1311:9`! - grtext_GetHeightcxx . . $ `grtext/grtext.h:164:9`!(str)) / 2, str); |
| 1549 | |
| 1550 | // Display data errors |
| 1551 | extern int Data_error_countcxx . . $ Data_error_count.; |
| 1552 | if (Data_error_countcxx . . $ Data_error_count.) { |
| 1553 | char buf[1024]; |
| 1554 | snprintf(buf, sizeof(buf), "This mission has %d data errors", Data_error_countcxx . . $ Data_error_count.); |
| 1555 | int y = 200 + 40; |
| 1556 | int x = 320 - (grtext_GetLineWidthcxx . . $ `grtext/grtext.h:172:9`!(buf) / 2); |
| 1557 | grtext_Printfcxx . . $ grtext_Printf(9514e36549094170).(x, y, buf); |
| 1558 | } |
| 1559 | |
| 1560 | if (step == LOAD_PROGRESS_PREPAREcxx . . $ `Descent3/Mission.h:177:9`!) { |
| 1561 | grtext_SetFontcxx . . $ grtext_SetFont(d4f767463ce0a6b3).(BIG_BRIEFING_FONTcxx . . $ `Descent3/gamefont.h:112:9`!); |
| 1562 | grtext_SetColorcxx . . $ grtext_SetColor(cb2f890c2fdad230).(GR_WHITEcxx . . $ GR_WHITE.); |
| 1563 | |
| 1564 | int preparey = 200; |
| 1565 | int preparex = 320 - (grtext_GetLineWidthcxx . . $ `grtext/grtext.h:172:9`!(TXT_PREPARE_FOR_DESCENTcxx . . $ `Descent3/stringtable.h:803:9`!) / 2); |
| 1566 | if (preparex < 0) |
| 1567 | preparex = 0; |
| 1568 | grtext_Printfcxx . . $ grtext_Printf(9514e36549094170).(preparex, preparey, TXT_PREPARE_FOR_DESCENTcxx . . $ `Descent3/stringtable.h:803:9`!); |
| 1569 | } |
| 1570 | // Display level name if still loading |
| 1571 | if ((pag_percent_loaded > 0.0) && step != LOAD_PROGRESS_PREPAREcxx . . $ `Descent3/Mission.h:177:9`!) { |
| 1572 | char str[255]; |
| 1573 | |
| 1574 | snprintf(str, sizeof(str), "\"%s\"", Level_infocxx . . $ Level_info..namecxx . . $ level_info#name.); |
| 1575 | grtext_SetFontcxx . . $ grtext_SetFont(d4f767463ce0a6b3).(BIG_BRIEFING_FONTcxx . . $ `Descent3/gamefont.h:112:9`!); |
| 1576 | grtext_SetColorcxx . . $ grtext_SetColor(cb2f890c2fdad230).(GR_WHITEcxx . . $ GR_WHITE.); |
| 1577 | |
| 1578 | int preparey = 200; |
| 1579 | int preparex = 320 - (grtext_GetLineWidthcxx . . $ `grtext/grtext.h:172:9`!(str) / 2); |
| 1580 | if (preparex < 0) |
| 1581 | preparex = 0; |
| 1582 | grtext_Printfcxx . . $ grtext_Printf(9514e36549094170).(preparex, preparey, str); |
| 1583 | } |
| 1584 | grtext_Flushcxx . . $ grtext_Flush(49f6e7a06ebc5aa8).(); |
| 1585 | EndFramecxx . . $ EndFrame(49f6e7a06ebc5aa8).(); |
| 1586 | rend_Flipcxx . . $ rend_Flip(49f6e7a06ebc5aa8).(); |
| 1587 | } |
| 1588 | /* this functions performs the end mission code |
| 1589 | */ |
| 1590 | void DoEndMissioncxx . . $ DoEndMission(49f6e7a06ebc5aa8).() { |
| 1591 | if (Game_modecxx . . $ Game_mode. & GM_MULTIcxx . . $ `Descent3/game.h:288:9`!) // If multiplayer, just loop |
| 1592 | { |
| 1593 | if (Dedicated_servercxx . . $ Dedicated_server.) |
| 1594 | PrintDedicatedMessagecxx . . $ PrintDedicatedMessage(326aeb464d16410c).(TXT_DS_MISSIONDONEcxx . . $ `Descent3/stringtable.h:603:9`!); |
| 1595 | SetCurrentLevelcxx . . $ SetCurrentLevel(d4f767463ce0a6b3).(1); |
| 1596 | return; |
| 1597 | } |
| 1598 | } |
| 1599 | // Shows some text on a background, useful for telling the player what is going on |
| 1600 | // ie "Loading level...", "Receiving data...", etc |
| 1601 | void ShowProgressScreencxx . . $ ShowProgressScreen(8d00172ec7558ddf).(const char *str, const char *str2, bool flip) { |
| 1602 | if (Dedicated_servercxx . . $ Dedicated_server.) { |
| 1603 | PrintDedicatedMessagecxx . . $ PrintDedicatedMessage(326aeb464d16410c).("%s\n", str); |
| 1604 | if (str2) |
| 1605 | PrintDedicatedMessagecxx . . $ PrintDedicatedMessage(326aeb464d16410c).("%s\n", str2); |
| 1606 | return; |
| 1607 | } |
| 1608 | StartFramecxx . . $ StartFrame(3285c9bef785d51c).(0, 0, Max_window_wcxx . . $ Max_window_w., Max_window_hcxx . . $ Max_window_h.); |
| 1609 | rend_ClearScreencxx . . $ rend_ClearScreen(cb2f890c2fdad230).(GR_BLACKcxx . . $ GR_BLACK.); |
| 1610 | grtext_SetFontcxx . . $ grtext_SetFont(d4f767463ce0a6b3).(MENU_FONTcxx . . $ `Descent3/gamefont.h:106:9`!); |
| 1611 | int text_height = grfont_GetHeightcxx . . $ grfont_GetHeight(7864480464b09eea).(MENU_FONTcxx . . $ `Descent3/gamefont.h:106:9`!); |
| 1612 | grtext_SetColorcxx . . $ grtext_SetColor(cb2f890c2fdad230).(GR_WHITEcxx . . $ GR_WHITE.); |
| 1613 | grtext_CenteredPrintfcxx . . $ grtext_CenteredPrintf(9514e36549094170).(0, Max_window_hcxx . . $ Max_window_h. / 2, str); |
| 1614 | if (str2) |
| 1615 | grtext_CenteredPrintfcxx . . $ grtext_CenteredPrintf(9514e36549094170).(0, (Max_window_hcxx . . $ Max_window_h. / 2) + (text_height * 2), str2); |
| 1616 | grtext_Flushcxx . . $ grtext_Flush(49f6e7a06ebc5aa8).(); |
| 1617 | EndFramecxx . . $ EndFrame(49f6e7a06ebc5aa8).(); |
| 1618 | if (flip) |
| 1619 | rend_Flipcxx . . $ rend_Flip(49f6e7a06ebc5aa8).(); |
| 1620 | } |
| 1621 | /* does a mission briefing, returns if mission was canceled, a false, or 0 value. |
| 1622 | first displays mission goals and some warnings or advice. |
| 1623 | may allow for selection of player ships |
| 1624 | */ |
| 1625 | bool DoMissionBriefingcxx . . $ DoMissionBriefing(83c267b20bac841a).(int level) { |
| 1626 | tLevelNodecxx . . $ tLevelNode# *lvl = Current_levelcxx . . $ Current_level.; |
| 1627 | bool ret = true; |
| 1628 | int num_ships = 0; |
| 1629 | for (int i = 0; i < MAX_SHIPScxx . . $ `Descent3/ship.h:122:9`!; i++) { |
| 1630 | if (Shipscxx . . $ Ships.[i].usedcxx . . $ ship#used. && PlayerIsShipAllowedcxx . . $ PlayerIsShipAllowed(cf9ef193275fa6d8).(Player_numcxx . . $ Player_num., i)) |
| 1631 | num_ships++; |
| 1632 | } |
| 1633 | if (lvl->briefnamecxx . . $ tLevelNode#briefname.[0] || num_ships > 1) |
| 1634 | ret = !TelComShowcxx . . $ TelComShow(636f4aecd7c651f4).(TS_MISSIONcxx . . $ `Descent3/TelCom.h:86:9`!, false, true); |
| 1635 | return ret; |
| 1636 | } |
| 1637 | extern bool FirstGamecxx . . $ FirstGame.; |
| 1638 | |
| 1639 | // --------------------------------------------------------------------------- |
| 1640 | // play movie |
| 1641 | void DoMissionMoviecxx . . $ DoMissionMovie(85c52e162fed56f9).(const char *movie) { |
| 1642 | if (PROGRAMcxx . . $ `Descent3/program.h:183:9`!(windowed)) { |
| 1643 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Skipping movie...can't do in windowed mode!\n"); |
| 1644 | return; |
| 1645 | } |
| 1646 | |
| 1647 | #ifdef D3_FAST |
| 1648 | return; |
| 1649 | #endif |
| 1650 | if (movie && *movie) { |
| 1651 | char mpath[_MAX_PATHcxx . . $ `linux/linux_fix.h:34:9`!]; |
| 1652 | ddio_MakePathcxx . . $ ddio_MakePath(9ad4b0815420a85).(mpath, LocalD3Dircxx . . $ LocalD3Dir., "movies", movie, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 1653 | PlayMoviecxx . . $ PlayMovie(c53a6ef3278968b1).(mpathcxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d).); |
| 1654 | } |
| 1655 | } |
| 1656 | |
| 1657 | /////////////////////////////////////////////////////////////////////////////// |
| 1658 | // Script Management for Missions and Levels |
| 1659 | /////////////////////////////////////////////////////////////////////////////// |
| 1660 | // Initializes a mission's default script |
| 1661 | bool InitMissionScriptcxx . . $ InitMissionScript(c9857a73d68e59ba).() { |
| 1662 | // need to do this so when UI runs, it has a background. |
| 1663 | // SetUICallback(DEFAULT_UICALLBACK); |
| 1664 | // if there is no default script, we will load a null script, which means that whatever object |
| 1665 | // uses scripts, will not do anything. |
| 1666 | //@@ fp = cfopen(DEFAULT_SCROBJ_NAME, "rb"); |
| 1667 | //@@ if (!fp) { |
| 1668 | //@@ DoMessageBox("Error", "Unable to find mission script.", MSGBOX_OK, UICOL_WINDOW_TITLE, |
| 1669 | // UICOL_TEXT_NORMAL); |
| 1670 | //@@ mprintf(0, "Unable to open default script. Loading null script...\n"); |
| 1671 | //@@ return false; |
| 1672 | //@@ } |
| 1673 | //@@ else { |
| 1674 | //@@ Current_mission.d3xmod = D3XLoadProgram(fp); |
| 1675 | //@@ if (!Current_mission.d3xmod) { |
| 1676 | //@@ DoMessageBox("Error", "Unable to find mission script.", MSGBOX_OK, UICOL_WINDOW_TITLE, |
| 1677 | // UICOL_TEXT_NORMAL); |
| 1678 | //@@ mprintf(0, "Unable to open default script. Loading null script...\n"); |
| 1679 | //@@ return false; |
| 1680 | //@@ } |
| 1681 | //@@ cfclose(fp); |
| 1682 | //@@ } |
| 1683 | return true; |
| 1684 | } |
| 1685 | extern bool IsRestoredGamecxx . . $ IsRestoredGame.; |
| 1686 | void InitLevelScriptcxx . . $ InitLevelScript(49f6e7a06ebc5aa8).() { |
| 1687 | if (Current_levelcxx . . $ Current_level.->filenamecxx . . $ tLevelNode#filename.) { |
| 1688 | char filename[_MAX_PATHcxx . . $ `linux/linux_fix.h:34:9`!], ext[_MAX_EXTcxx . . $ `linux/linux_fix.h:36:9`!]; |
| 1689 | ddio_SplitPathcxx . . $ ddio_SplitPath(b05ba7ab99603c07).(Current_levelcxx . . $ Current_level.->filenamecxx . . $ tLevelNode#filename., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, filename, ext); |
| 1690 | #if defined(WIN32) |
| 1691 | strcat(filename, ".dll"); |
| 1692 | #elif defined(MACOSX) |
| 1693 | strcat(filename, ".dylib"); |
| 1694 | #elif defined(__LINUX__cxx . . $ `<external>/8627488274992530813/SDL_platform.h:61:9`!) |
| 1695 | strcat(filename, ".so"); |
| 1696 | #else |
| 1697 | #error Unsupported platform! |
| 1698 | #endif |
| 1699 | Osiris_LoadLevelModulecxx . . $ Osiris_LoadLevelModule(1ef8e6ec083aabb9).(filename); |
| 1700 | } |
| 1701 | //@$-D3XExecScript(Current_level->d3xthread, Current_mission.cur_level, REF_LEVELTYPE, EVT_LEVELSTART, 0, 0); |
| 1702 | tOSIRISEventInfocxx . . $ tOSIRISEventInfo# ei; |
| 1703 | // This is a hack... we don't want the level start script to be called when restoring a save game |
| 1704 | if (!IsRestoredGamecxx . . $ IsRestoredGame.) |
| 1705 | Osiris_CallLevelEventcxx . . $ Osiris_CallLevelEvent(a880c8b99cdc05b4).(EVT_LEVELSTARTcxx . . $ `scripts/osiris_common.h:373:9`!, &ei); |
| 1706 | AssignScriptsForLevelcxx . . $ AssignScriptsForLevel(49f6e7a06ebc5aa8).(); // initialize all scripts for level. |
| 1707 | } |
| 1708 | void FreeLevelScriptcxx . . $ FreeLevelScript(49f6e7a06ebc5aa8).() { |
| 1709 | Osiris_UnloadLevelModulecxx . . $ Osiris_UnloadLevelModule(49f6e7a06ebc5aa8).(); |
| 1710 | if (Current_levelcxx . . $ Current_level.) { |
| 1711 | // free level's script and thread |
| 1712 | //@$-D3XExecScript(Current_level->d3xthread, Current_mission.cur_level, REF_LEVELTYPE, EVT_LEVELEND, 0, 0); |
| 1713 | tOSIRISEventInfocxx . . $ tOSIRISEventInfo# ei; |
| 1714 | Osiris_CallLevelEventcxx . . $ Osiris_CallLevelEvent(a880c8b99cdc05b4).(EVT_LEVELENDcxx . . $ `scripts/osiris_common.h:374:9`!, &ei); |
| 1715 | } |
| 1716 | } |
| 1717 | // return information about a mission |
| 1718 | bool GetMissionInfocxx . . $ GetMissionInfo(5ac525d2e85070d7).(const char *msnfile, tMissionInfocxx . . $ tMissionInfo# *msn) { |
| 1719 | CFILEcxx . . $ CFILE# *fp; |
| 1720 | bool indesc = false; // are we in a multi-line block |
| 1721 | // open mission file |
| 1722 | if (IS_MN3_FILEcxx . . $ IS_MN3_FILE(c5f7da30cbc0f4e9).(msnfile)) { |
| 1723 | return mn3_GetInfocxx . . $ mn3_GetInfo(5ac525d2e85070d7).(msnfile, msn); |
| 1724 | } |
| 1725 | fp = cfopencxx . . $ cfopen(7c7b94e455f1ae56).(msnfilecxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d)., "rt"); |
| 1726 | if (!fp) { |
| 1727 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Failed to open mission file %s in GetMissionInfo.\n", msnfile); |
| 1728 | return false; |
| 1729 | } |
| 1730 | msn->multicxx . . $ tMissionInfo#multi. = true; |
| 1731 | msn->singlecxx . . $ tMissionInfo#single. = true; |
| 1732 | msn->trainingcxx . . $ tMissionInfo#training. = false; |
| 1733 | msn->authorcxx . . $ tMissionInfo#author.[0] = 0; |
| 1734 | msn->desccxx . . $ tMissionInfo#desc.[0] = 0; |
| 1735 | while (!cfeofcxx . . $ cfeof(413716a422df0036).(fp)) { |
| 1736 | char srcline[128]; // One line of mission source |
| 1737 | char command[32]; // Command read from line. |
| 1738 | char operand[96]; // operand read from line |
| 1739 | char *keyword; // parsed keyword |
| 1740 | int readcount; // read-in count |
| 1741 | readcount = cf_ReadStringcxx . . $ cf_ReadString(38cd788e4423eff6).(srcline, sizeof(srcline), fp); |
| 1742 | if (readcount) { |
| 1743 | // we have a line of source. parse out primary keyword |
| 1744 | // then parse out remainder. |
| 1745 | keyword = strtok(srcline, " \t"); |
| 1746 | CleanupStrcxx . . $ CleanupStr(55abe9014c6d0e39).(command, srcline, sizeof(command)); |
| 1747 | CleanupStrcxx . . $ CleanupStr(55abe9014c6d0e39).(operand, srcline + strlen(command) + 1, sizeof(operand)); |
| 1748 | if (strlen(command) && indesc) |
| 1749 | indesc = false; |
| 1750 | if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(command, "NAME")) { |
| 1751 | strncpy(msn->namecxx . . $ tMissionInfo#name., operand, MSN_NAMELENcxx . . $ `Descent3/descent.h:181:9`! - 1); |
| 1752 | } else if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(command, "MULTI")) { |
| 1753 | if (stricmpcxx . . $ `linux/linux_fix.h:43:9`!("no", operand) == 0) |
| 1754 | msn->multicxx . . $ tMissionInfo#multi. = false; |
| 1755 | } else if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(command, "SINGLE")) { |
| 1756 | if (stricmpcxx . . $ `linux/linux_fix.h:43:9`!("no", operand) == 0) |
| 1757 | msn->singlecxx . . $ tMissionInfo#single. = false; |
| 1758 | } else if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(command, "TRAINER")) { |
| 1759 | msn->trainingcxx . . $ tMissionInfo#training. = true; |
| 1760 | } else if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(command, "AUTHOR")) { |
| 1761 | strncpy(msn->authorcxx . . $ tMissionInfo#author., operand, MSN_NAMELENcxx . . $ `Descent3/descent.h:181:9`! - 1); |
| 1762 | } else if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(command, "DESCRIPTION") || indesc) { |
| 1763 | // multi-line descriptions require the strcat. the initial |
| 1764 | // strings should be empty for this to work. |
| 1765 | strcat(msn->desccxx . . $ tMissionInfo#desc., operand); |
| 1766 | if (indesc) |
| 1767 | strcat(msn->desccxx . . $ tMissionInfo#desc., "\n"); |
| 1768 | indesc = true; // this is a multiline command |
| 1769 | } else if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(command, "NUMLEVELS")) { |
| 1770 | // get number of levels |
| 1771 | int value = atoi(operand); |
| 1772 | msn->n_levelscxx . . $ tMissionInfo#n_levels. = value; |
| 1773 | } else if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(command, "LEVEL")) { |
| 1774 | break; |
| 1775 | } else if (!stricmpcxx . . $ `linux/linux_fix.h:43:9`!(command, "KEYWORDS")) { |
| 1776 | // Read in all the keywords |
| 1777 | strncpy(msn->keywordscxx . . $ tMissionInfo#keywords., operand, MAX_KEYWORDLENcxx . . $ `Descent3/Mission.h:186:9`!); |
| 1778 | } |
| 1779 | } |
| 1780 | } |
| 1781 | cfclosecxx . . $ cfclose(3639e799710acb68).(fp); |
| 1782 | return true; |
| 1783 | } |
| 1784 | // --------------------------------------------------------------------------- |
| 1785 | const char *GetMissionNamecxx . . $ GetMissionName(fb58d2e09a2a1ce6).(const char *mission) { |
| 1786 | tMissionInfocxx . . $ tMissionInfo# msninfo; |
| 1787 | static char msnname[MSN_NAMELENcxx . . $ `Descent3/descent.h:181:9`!]; |
| 1788 | msnname[0] = 0; |
| 1789 | if (GetMissionInfocxx . . $ GetMissionInfo(5ac525d2e85070d7).(mission, &msninfo)) { |
| 1790 | strcpy(msnname, msninfo.namecxx . . $ tMissionInfo#name.); |
| 1791 | } else { |
| 1792 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "MISSION:GetMissionName failed from call to GetMissionInfo\n"); |
| 1793 | } |
| 1794 | return msnname; |
| 1795 | } |
| 1796 | bool IsMissionMultiPlayablecxx . . $ IsMissionMultiPlayable(c5f7da30cbc0f4e9).(const char *mission) { |
| 1797 | tMissionInfocxx . . $ tMissionInfo# msninfo; |
| 1798 | if (GetMissionInfocxx . . $ GetMissionInfo(5ac525d2e85070d7).(mission, &msninfo)) { |
| 1799 | return msninfo.multicxx . . $ tMissionInfo#multi.; |
| 1800 | } |
| 1801 | return false; |
| 1802 | } |
| 1803 | bool IsMissionSinglePlayablecxx . . $ IsMissionSinglePlayable(c5f7da30cbc0f4e9).(const char *mission) { |
| 1804 | tMissionInfocxx . . $ tMissionInfo# msninfo; |
| 1805 | if (GetMissionInfocxx . . $ GetMissionInfo(5ac525d2e85070d7).(mission, &msninfo)) { |
| 1806 | return msninfo.singlecxx . . $ tMissionInfo#single.; |
| 1807 | } |
| 1808 | return false; |
| 1809 | } |
| 1810 | int Mission_voice_hog_handlecxx . . $ Mission_voice_hog_handle. = 0; |
| 1811 | // MN3 based mission functions. |
| 1812 | // loads the msn file from the mn3 file specified, specifies the hog and table file. |
| 1813 | bool mn3_Opencxx . . $ mn3_Open(c5f7da30cbc0f4e9).(const char *mn3file) { |
| 1814 | char pathname[_MAX_PATHcxx . . $ `linux/linux_fix.h:34:9`!]; |
| 1815 | char filename[PSFILENAME_LENcxx . . $ `lib/pstypes.h:31:9`! + 1]; |
| 1816 | char ext[PSFILENAME_LENcxx . . $ `lib/pstypes.h:31:9`!]; |
| 1817 | int mn3_handle; |
| 1818 | // concatanate the mn3 extension if it isn't there. |
| 1819 | char tempMn3File[_MAX_PATHcxx . . $ `linux/linux_fix.h:34:9`!]; |
| 1820 | if (!IS_MN3_FILEcxx . . $ IS_MN3_FILE(c5f7da30cbc0f4e9).(mn3file)) { |
| 1821 | strncpy(tempMn3File, mn3file, sizeof(tempMn3File) - 1); |
| 1822 | tempMn3File[sizeof(tempMn3File) - 1] = 0; |
| 1823 | strcat(tempMn3File, ".mn3"); |
| 1824 | mn3file = tempMn3File; |
| 1825 | } |
| 1826 | |
| 1827 | ddio_MakePathcxx . . $ ddio_MakePath(9ad4b0815420a85).(pathname, D3MissionsDircxx . . $ D3MissionsDir., mn3file, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 1828 | // open MN3 HOG. |
| 1829 | mn3_handle = cf_OpenLibrarycxx . . $ cf_OpenLibrary(293b0826c8d9cb54).(mn3filecxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d).); |
| 1830 | if (mn3_handle == 0) { |
| 1831 | return false; |
| 1832 | } else { |
| 1833 | Osiris_ExtractScriptsFromHogcxx . . $ Osiris_ExtractScriptsFromHog(d455ce14f374a3ab).(mn3_handle, true); |
| 1834 | } |
| 1835 | // do table file stuff. |
| 1836 | ddio_SplitPathcxx . . $ ddio_SplitPath(b05ba7ab99603c07).(mn3file, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, filename, ext); |
| 1837 | |
| 1838 | char voice_hog[_MAX_PATHcxx . . $ `linux/linux_fix.h:34:9`!*2]; |
| 1839 | if ((stricmpcxx . . $ `linux/linux_fix.h:43:9`!(filename, "d3") == 0) || (stricmpcxx . . $ `linux/linux_fix.h:43:9`!(filename, "training") == 0)) { |
| 1840 | // Open audio hog file |
| 1841 | ddio_MakePathcxx . . $ ddio_MakePath(9ad4b0815420a85).(voice_hog, D3MissionsDircxx . . $ D3MissionsDir., "d3voice1.hog", nullptr); // Audio for levels 1-4 |
| 1842 | Mission_voice_hog_handlecxx . . $ Mission_voice_hog_handle. = cf_OpenLibrarycxx . . $ cf_OpenLibrary(293b0826c8d9cb54).(voice_hogcxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d).); |
| 1843 | } else if (stricmpcxx . . $ `linux/linux_fix.h:43:9`!(filename, "d3_2") == 0) { |
| 1844 | // Open audio hog file |
| 1845 | ddio_MakePathcxx . . $ ddio_MakePath(9ad4b0815420a85).(voice_hog, D3MissionsDircxx . . $ D3MissionsDir., "d3voice2.hog", nullptr); // Audio for levels 5-17 |
| 1846 | Mission_voice_hog_handlecxx . . $ Mission_voice_hog_handle. = cf_OpenLibrarycxx . . $ cf_OpenLibrary(293b0826c8d9cb54).(voice_hogcxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d).); |
| 1847 | } |
| 1848 | strcat(filename, ".gam"); |
| 1849 | mng_SetAddonTablecxx . . $ mng_SetAddonTable(c6b7e35ff6de5671).(filename); |
| 1850 | Current_missioncxx . . $ Current_mission..mn3_handlecxx . . $ tMission#mn3_handle. = mn3_handle; |
| 1851 | return true; |
| 1852 | } |
| 1853 | |
| 1854 | // returns mission information given the mn3 file. |
| 1855 | bool mn3_GetInfocxx . . $ mn3_GetInfo(5ac525d2e85070d7).(const char *mn3file, tMissionInfocxx . . $ tMissionInfo# *msn) { |
| 1856 | int handle; |
| 1857 | bool retval; |
| 1858 | char pathname[_MAX_PATHcxx . . $ `linux/linux_fix.h:34:9`!]; |
| 1859 | char filename[PSFILENAME_LENcxx . . $ `lib/pstypes.h:31:9`! + 1]; |
| 1860 | |
| 1861 | ddio_MakePathcxx . . $ ddio_MakePath(9ad4b0815420a85).(pathname, D3MissionsDircxx . . $ D3MissionsDir., mn3file, nullptr); |
| 1862 | handle = cf_OpenLibrarycxx . . $ cf_OpenLibrary(293b0826c8d9cb54).(pathnamecxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d).); |
| 1863 | if (handle == 0) { |
| 1864 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "MISSION: MN3 failed to open.\n"); |
| 1865 | return false; |
| 1866 | } |
| 1867 | MN3_TO_MSN_NAMEcxx . . $ MN3_TO_MSN_NAME(ed8193f262e4eda).(mn3file, filename); |
| 1868 | retval = GetMissionInfocxx . . $ GetMissionInfo(5ac525d2e85070d7).(filename, msn); |
| 1869 | cf_CloseLibrarycxx . . $ cf_CloseLibrary(d4f767463ce0a6b3).(handle); |
| 1870 | return retval; |
| 1871 | } |
| 1872 | // closes the current mn3 file |
| 1873 | void mn3_Closecxx . . $ mn3_Close(49f6e7a06ebc5aa8).() { |
| 1874 | if (Current_missioncxx . . $ Current_mission..mn3_handlecxx . . $ tMission#mn3_handle.) { |
| 1875 | Osiris_ClearExtractedScriptscxx . . $ Osiris_ClearExtractedScripts(b45ddcbc8423892c).(true); |
| 1876 | cf_CloseLibrarycxx . . $ cf_CloseLibrary(d4f767463ce0a6b3).(Current_missioncxx . . $ Current_mission..mn3_handlecxx . . $ tMission#mn3_handle.); |
| 1877 | } |
| 1878 | if (Mission_voice_hog_handlecxx . . $ Mission_voice_hog_handle.) { |
| 1879 | cf_CloseLibrarycxx . . $ cf_CloseLibrary(d4f767463ce0a6b3).(Mission_voice_hog_handlecxx . . $ Mission_voice_hog_handle.); |
| 1880 | Mission_voice_hog_handlecxx . . $ Mission_voice_hog_handle. = 0; |
| 1881 | } |
| 1882 | Current_missioncxx . . $ Current_mission..mn3_handlecxx . . $ tMission#mn3_handle. = 0; |
| 1883 | } |
| 1884 | #define KEYWORD_LENcxx . . $ `Descent3/Mission.cpp:1884:9`! 16 |
| 1885 | #define NUM_KEYWORDScxx . . $ `Descent3/Mission.cpp:1885:9`! 16 |
| 1886 | #define GOALSTEXTcxx . . $ `Descent3/Mission.cpp:1886:9`! "GOALS" |
| 1887 | #define GOALSTEXTLENcxx . . $ `Descent3/Mission.cpp:1887:9`! strlen(GOALSTEXTcxx . . $ `Descent3/Mission.cpp:1886:9`!) |
| 1888 | #define MODMINGOALScxx . . $ `Descent3/Mission.cpp:1888:9`! "MINGOALS" |
| 1889 | #define MODMINGOALSLENcxx . . $ `Descent3/Mission.cpp:1889:9`! strlen(MODMINGOALScxx . . $ `Descent3/Mission.cpp:1888:9`!) |
| 1890 | // Returns the max number of teams this mission can support for this mod, or |
| 1891 | //-1 if this level shouldn't be played with this mission |
| 1892 | // Return values: |
| 1893 | // -1 Bad match -- this level and this mod shouldn't be played together! |
| 1894 | // MAX_NET_PLAYERS -- This is playable with any number of teams the mod wants |
| 1895 | int MissionGetKeywordscxx . . $ MissionGetKeywords(2f051e3560ff300f).(const char *mission, char *keywords) { |
| 1896 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(mission); |
| 1897 | ASSERTcxx . . $ `misc/pserror.h:246:9`!(keywords); |
| 1898 | |
| 1899 | char msn_keywords[NUM_KEYWORDScxx . . $ `Descent3/Mission.cpp:1885:9`!][KEYWORD_LENcxx . . $ `Descent3/Mission.cpp:1884:9`!]; |
| 1900 | char mod_keywords[NUM_KEYWORDScxx . . $ `Descent3/Mission.cpp:1885:9`!][KEYWORD_LENcxx . . $ `Descent3/Mission.cpp:1884:9`!]; |
| 1901 | int i; |
| 1902 | char *parse_keys = mem_strdupcxx . . $ `mem/mem.h:81:9`!(keywords); |
| 1903 | char seps[] = ","; |
| 1904 | int teams = MAX_NET_PLAYERScxx . . $ `Descent3/multi_external.h:132:9`!; |
| 1905 | int goals = 0; |
| 1906 | int goalsneeded = 0; |
| 1907 | int mod_key_count = 0; |
| 1908 | int msn_key_count = 0; |
| 1909 | bool goal_per_team = false; |
| 1910 | tMissionInfocxx . . $ tMissionInfo# msn_info; |
| 1911 | |
| 1912 | memset(msn_keywords, 0, sizeof(msn_keywords)); |
| 1913 | memset(mod_keywords, 0, sizeof(mod_keywords)); |
| 1914 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "MissionGetKeywords(%s,%s)\n", mission, keywords); |
| 1915 | if (!GetMissionInfocxx . . $ GetMissionInfo(5ac525d2e85070d7).(mission, &msn_info)) { |
| 1916 | return -1; |
| 1917 | } |
| 1918 | |
| 1919 | if (!*parse_keys) { |
| 1920 | return MAX_NET_PLAYERScxx . . $ `Descent3/multi_external.h:132:9`!; |
| 1921 | } |
| 1922 | // Break up the mod keywords into an array |
| 1923 | char *tokp = strtok(parse_keys, seps); |
| 1924 | if (tokp) { |
| 1925 | do { |
| 1926 | strcpy(mod_keywords[mod_key_count], tokp); |
| 1927 | mod_key_count++; |
| 1928 | tokp = strtok(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, seps); |
| 1929 | } while ((tokp) && (mod_key_count < NUM_KEYWORDScxx . . $ `Descent3/Mission.cpp:1885:9`!)); |
| 1930 | } |
| 1931 | // Break up the msn keywords into an array |
| 1932 | tokp = strtok(msn_info.keywordscxx . . $ tMissionInfo#keywords., seps); |
| 1933 | if (tokp) { |
| 1934 | do { |
| 1935 | strcpy(msn_keywords[msn_key_count], tokp); |
| 1936 | msn_key_count++; |
| 1937 | tokp = strtok(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, seps); |
| 1938 | } while ((tokp) && (msn_key_count < NUM_KEYWORDScxx . . $ `Descent3/Mission.cpp:1885:9`!)); |
| 1939 | } |
| 1940 | |
| 1941 | for (i = 0; i < NUM_KEYWORDScxx . . $ `Descent3/Mission.cpp:1885:9`!; i++) { |
| 1942 | if (msn_keywords[i][0] == 0) { |
| 1943 | continue; |
| 1944 | } |
| 1945 | if (strnicmpcxx . . $ `linux/linux_fix.h:44:9`!(GOALSTEXTcxx . . $ `Descent3/Mission.cpp:1886:9`!, msn_keywords[i], GOALSTEXTLENcxx . . $ `Descent3/Mission.cpp:1887:9`!) == 0) { |
| 1946 | // Get the number of goals this game has |
| 1947 | goals = atoi(msn_keywords[i] + GOALSTEXTLENcxx . . $ `Descent3/Mission.cpp:1887:9`!); |
| 1948 | } |
| 1949 | } |
| 1950 | mem_freecxx . . $ `mem/mem.h:80:9`!(parse_keys); |
| 1951 | |
| 1952 | // Loop through looking for matches |
| 1953 | for (i = 0; i < NUM_KEYWORDScxx . . $ `Descent3/Mission.cpp:1885:9`!; i++) { |
| 1954 | if (mod_keywords[i][0] == 0) { |
| 1955 | continue; |
| 1956 | } |
| 1957 | if (strnicmpcxx . . $ `linux/linux_fix.h:44:9`!(mod_keywords[i], MODMINGOALScxx . . $ `Descent3/Mission.cpp:1888:9`!, MODMINGOALSLENcxx . . $ `Descent3/Mission.cpp:1889:9`!) == 0) { |
| 1958 | goalsneeded = atoi(mod_keywords[i] + MODMINGOALSLENcxx . . $ `Descent3/Mission.cpp:1889:9`!); |
| 1959 | } else if (stricmpcxx . . $ `linux/linux_fix.h:43:9`!("GOALPERTEAM", mod_keywords[i]) == 0) { |
| 1960 | goal_per_team = true; |
| 1961 | } else { |
| 1962 | bool found_keyword = false; |
| 1963 | // Loop through looking for matches |
| 1964 | for (int a = 0; a < NUM_KEYWORDScxx . . $ `Descent3/Mission.cpp:1885:9`!; a++) { |
| 1965 | if (msn_keywords[a][0] == 0) { |
| 1966 | continue; |
| 1967 | } |
| 1968 | if (stricmpcxx . . $ `linux/linux_fix.h:43:9`!(msn_keywords[a], mod_keywords[i]) == 0) { |
| 1969 | // Woohoo! it's found |
| 1970 | found_keyword = true; |
| 1971 | break; |
| 1972 | } |
| 1973 | } |
| 1974 | // We never found one we needed, so return -1; |
| 1975 | if (!found_keyword) { |
| 1976 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "%s keyword needed in %s not found!\n", mod_keywords[i], mission); |
| 1977 | return -1; |
| 1978 | } |
| 1979 | } |
| 1980 | } |
| 1981 | if (goal_per_team) { |
| 1982 | teams = goals; |
| 1983 | } |
| 1984 | if (teams < goalsneeded) { |
| 1985 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Not enough goals in this level!\n"); |
| 1986 | teams = -1; |
| 1987 | } |
| 1988 | if (goals < goalsneeded) { |
| 1989 | mprintfcxx . . $ `ddebug/mono.h:82:9`!(0, "Not enough goals in this level!\n"); |
| 1990 | teams = -1; |
| 1991 | } |
| 1992 | return teams; |
| 1993 | } |
| 1994 | ////////////////////////////////////////////////////////////////////////////// |
| 1995 | #ifdef EDITOR |
| 1996 | // Used by editor->game to load all necessary elements for level playing for systems |
| 1997 | // not initialized in editor, but only in game. |
| 1998 | extern char Editor_quickplay_levelname[_MAX_PATH]; |
| 1999 | void QuickStartMission() { |
| 2000 | // create the level script code here, if we really need to. |
| 2001 | ResetGamemode(); |
| 2002 | // this initializes a mini one level mission with no frills. |
| 2003 | Current_mission.cur_level = 1; |
| 2004 | Current_mission.num_levels = 1; |
| 2005 | Current_mission.levels = (tLevelNode *)mem_malloc(sizeof(tLevelNode)); |
| 2006 | memset(Current_mission.levels, 0, sizeof(tLevelNode)); |
| 2007 | Current_level = Current_mission.levels; |
| 2008 | if (Editor_quickplay_levelname[0] != '\0') |
| 2009 | Current_level->filename = mem_strdup(Editor_quickplay_levelname); |
| 2010 | else |
| 2011 | Current_level->filename = NULL; |
| 2012 | // proceed with initialization. |
| 2013 | InitMissionScript(); |
| 2014 | SetGameState(GAMESTATE_LVLSTART); |
| 2015 | } |
| 2016 | // Used by game->editor to free up all extra game mission elements not needed in editor. |
| 2017 | void QuickEndMission() { |
| 2018 | //@@ FreeScriptsForLevel(); |
| 2019 | //@@ D3XFreeProgram(Current_mission.d3xmod); |
| 2020 | //@@ Current_mission.d3xmod = NULL; |
| 2021 | // free up mini mission. |
| 2022 | //@@ Current_level = NULL; |
| 2023 | //@@ mem_free(Current_mission.levels); |
| 2024 | //@@ Current_mission.levels = NULL; |
| 2025 | ResetMission(); |
| 2026 | } |
| 2027 | #endif |