|
40 | 40 | #include <sstream> |
41 | 41 | #include "../Engine/Options.h" |
42 | 42 | #include "../Engine/Screen.h" |
| 43 | +#include "../Menu/CutsceneState.h" |
43 | 44 |
|
44 | 45 | namespace OpenXcom |
45 | 46 | { |
@@ -76,19 +77,21 @@ BriefingState::BriefingState(Craft *craft, Base *base) |
76 | 77 | if (!deployment) // none defined - should never happen, but better safe than sorry i guess. |
77 | 78 | { |
78 | 79 | setPalette("PAL_GEOSCAPE", 0); |
79 | | - _game->getResourcePack()->playMusic("GMDEFEND"); |
| 80 | + _musicId = "GMDEFEND"; |
80 | 81 | _window->setBackground(_game->getResourcePack()->getSurface("BACK16.SCR")); |
81 | 82 | } |
82 | 83 | else |
83 | 84 | { |
84 | 85 | BriefingData data = deployment->getBriefingData(); |
85 | 86 | setPalette("PAL_GEOSCAPE", data.palette); |
86 | | - _game->getResourcePack()->playMusic(data.music); |
87 | 87 | _window->setBackground(_game->getResourcePack()->getSurface(data.background)); |
88 | 88 | _txtCraft->setY(56 + data.textOffset); |
89 | 89 | _txtBriefing->setY(72 + data.textOffset); |
90 | 90 | _txtTarget->setVisible(data.showTarget); |
91 | 91 | _txtCraft->setVisible(data.showCraft); |
| 92 | + |
| 93 | + _cutsceneId = data.cutscene; |
| 94 | + _musicId = data.music; |
92 | 95 | } |
93 | 96 |
|
94 | 97 | add(_window, "window", "briefing"); |
@@ -156,6 +159,23 @@ BriefingState::~BriefingState() |
156 | 159 |
|
157 | 160 | } |
158 | 161 |
|
| 162 | +void BriefingState::init() |
| 163 | +{ |
| 164 | + State::init(); |
| 165 | + |
| 166 | + if (!_cutsceneId.empty()) |
| 167 | + { |
| 168 | + _game->pushState(new CutsceneState(_cutsceneId)); |
| 169 | + |
| 170 | + // don't play the cutscene again when we return to this state |
| 171 | + _cutsceneId = ""; |
| 172 | + } |
| 173 | + else |
| 174 | + { |
| 175 | + _game->getResourcePack()->playMusic(_musicId); |
| 176 | + } |
| 177 | +} |
| 178 | + |
159 | 179 | /** |
160 | 180 | * Closes the window. |
161 | 181 | * @param action Pointer to an action. |
|
0 commit comments