|
6 | 6 | #include "hud.h"
|
7 | 7 | #include "weapon.h"
|
8 | 8 | #include <TFE_Game/igame.h>
|
| 9 | +#include <TFE_DarkForces/mission.h> |
9 | 10 | #include <TFE_FileSystem/fileutil.h>
|
10 | 11 | #include <TFE_FileSystem/paths.h>
|
| 12 | +#include <TFE_Settings/settings.h> |
11 | 13 | #include <TFE_System/system.h>
|
12 | 14 | #include <TFE_System/parser.h>
|
13 | 15 | #include <TFE_Jedi/Serialization/serialization.h>
|
@@ -180,12 +182,23 @@ namespace TFE_DarkForces
|
180 | 182 | void levelEndTaskFunc(MessageType msg)
|
181 | 183 | {
|
182 | 184 | task_begin;
|
183 |
| - while (1) |
| 185 | + |
| 186 | + // If you are using the auto end mission setting, then just wait a few seconds and end the level. |
| 187 | + if (TFE_Settings::getGameSettings()->df_autoEndMission) |
184 | 188 | {
|
185 |
| - hud_sendTextMessage(461); |
186 |
| - task_yield(582); // ~4 seconds |
187 |
| - hud_sendTextMessage(462); |
188 |
| - task_yield(4369); // ~30 seconds |
| 189 | + task_yield(873); // ~ 6 seconds |
| 190 | + mission_setExitLevel(JTRUE); |
| 191 | + } |
| 192 | + else |
| 193 | + { |
| 194 | + // Otherwise loop the end level message until the player exits through the escape menu. |
| 195 | + while (1) |
| 196 | + { |
| 197 | + hud_sendTextMessage(461); |
| 198 | + task_yield(582); // ~4 seconds |
| 199 | + hud_sendTextMessage(462); |
| 200 | + task_yield(4369); // ~30 seconds |
| 201 | + } |
189 | 202 | }
|
190 | 203 | task_end;
|
191 | 204 | }
|
@@ -541,10 +554,19 @@ namespace TFE_DarkForces
|
541 | 554 | }
|
542 | 555 | else
|
543 | 556 | {
|
544 |
| - // Finally generate a new one. |
545 |
| - TFE_System::logWrite(LOG_WARNING, "DarkForcesMain", "Cannot find 'DARKPILO.CFG' at '%s'. Creating a new file for save data.", sourcePath); |
546 |
| -newpilo: |
547 |
| - createDarkPilotConfig(documentsPath); |
| 557 | + // Also check the remaster documents path. |
| 558 | + TFE_Paths::appendPath(PATH_REMASTER_DOCS, "DARKPILO.CFG", sourcePath); |
| 559 | + if (FileUtil::exists(sourcePath)) |
| 560 | + { |
| 561 | + FileUtil::copyFile(sourcePath, documentsPath); |
| 562 | + } |
| 563 | + else |
| 564 | + { |
| 565 | + // Finally generate a new one. |
| 566 | + TFE_System::logWrite(LOG_WARNING, "DarkForcesMain", "Cannot find 'DARKPILO.CFG' at '%s'. Creating a new file for save data.", sourcePath); |
| 567 | + newpilo: |
| 568 | + createDarkPilotConfig(documentsPath); |
| 569 | + } |
548 | 570 | }
|
549 | 571 | }
|
550 | 572 | }
|
|
0 commit comments