|
38 | 38 | #include "ccfile.h" |
39 | 39 | #include "ccini.h" |
40 | 40 | #include "addon.h" |
| 41 | +#include "wwmouse.h" |
| 42 | +#include "restate.h" |
41 | 43 | #include "fatal.h" |
42 | 44 | #include "debughandler.h" |
43 | 45 | #include "asserthandler.h" |
|
46 | 48 | #include "hooker_macros.h" |
47 | 49 |
|
48 | 50 |
|
| 51 | +/** |
| 52 | + * Show the mission briefing statement. |
| 53 | + * |
| 54 | + * @author: CCHyper |
| 55 | + */ |
| 56 | +static void Scenario_Show_Mission_Briefing() |
| 57 | +{ |
| 58 | + char buffer[25]; |
| 59 | + |
| 60 | + /** |
| 61 | + * If there's no briefing movie, restate the mission at the beginning. |
| 62 | + */ |
| 63 | + if (Scen->BriefMovie != VQ_NONE) { |
| 64 | + std::snprintf(buffer, sizeof(buffer), "%s.VQA", Movies[Scen->BriefMovie]); |
| 65 | + } |
| 66 | + |
| 67 | + /** |
| 68 | + * Briefings are only displayed in normal games when no briefing video is found. |
| 69 | + * |
| 70 | + * #issue-28 |
| 71 | + * |
| 72 | + * Also, Show the briefing if the scenario has been flagged to show it. |
| 73 | + */ |
| 74 | + if (Session.Type == GAME_NORMAL && (Scen->BriefMovie == VQ_NONE || !CCFileClass(buffer).Is_Available() || ScenExtension->IsShowBriefing)) { |
| 75 | + |
| 76 | + /** |
| 77 | + * Make sure the mouse is visible before showing the restatement. |
| 78 | + */ |
| 79 | + while (WWMouse->Get_Mouse_State()) { |
| 80 | + WWMouse->Show_Mouse(); |
| 81 | + } |
| 82 | + |
| 83 | + /** |
| 84 | + * Show the mission briefing screen. |
| 85 | + */ |
| 86 | + Restate_Mission(Scen); |
| 87 | + } |
| 88 | +} |
| 89 | + |
| 90 | +/** |
| 91 | + * This patch replaces the section of code in Start_Scenario() that shows |
| 92 | + * the mission briefing statement if no briefing video is found. |
| 93 | + * |
| 94 | + * @author: CCHyper |
| 95 | + */ |
| 96 | +DECLARE_PATCH(_Start_Scenario_BriefMovie_RestateMission_Patch) |
| 97 | +{ |
| 98 | + /** |
| 99 | + * Show the mission briefing statement. |
| 100 | + */ |
| 101 | + Scenario_Show_Mission_Briefing(); |
| 102 | + |
| 103 | + /** |
| 104 | + * Continue to showing the Dropship Loadout menu (if enabled). |
| 105 | + */ |
| 106 | + _asm { mov eax, 0x007E2438 } // Scen |
| 107 | + JMP_REG(ecx, 0x005DB3B1); |
| 108 | +} |
| 109 | + |
| 110 | + |
49 | 111 | /** |
50 | 112 | * Process additions to the Rules data from the input file. |
51 | 113 | * |
@@ -178,4 +240,5 @@ void ScenarioClassExtension_Hooks() |
178 | 240 | Patch_Jump(0x005DC9D4, &_Do_Win_Skip_MPlayer_Score_Screen_Patch); |
179 | 241 | Patch_Jump(0x005DCD92, &_Do_Lose_Skip_MPlayer_Score_Screen_Patch); |
180 | 242 | Patch_Jump(0x005DD8D5, &_Read_Scenario_INI_MPlayer_INI_Patch); |
| 243 | + Patch_Jump(0x005DB37F, &_Start_Scenario_BriefMovie_RestateMission_Patch); |
181 | 244 | } |
0 commit comments