17 constexpr std::array
MovieNames{
"HLogo",
"ALogo",
"MIntro"};
19 std::optional<std::string>
resolveMovie(
const data::ResourcePaths& paths,
22 const auto find = [&](std::string_view
extension) -> std::optional<std::string> {
24 if (paths.resolve(
name))
return name;
30 if (
auto bink = find(
".bik"))
return bink;
35 void Controller::stopOwnedNodes(engine::SequencePlayback&
playback)
37 if (trademark_ &&
playback.runtime().inspect(trademark_))
39 if (movie_ &&
playback.runtime().inspect(movie_))
40 (
void)
playback.runtime().stop(movie_);
43 trademark_ = movie_ = 0;
52 selectionRequested_ =
false;
61 selectionRequested_ =
true;
68 error_ = std::move(
error);
83 trademarkStarted_ = tick;
90 auto node =
playback.runtime().start(*program, 0);
106 const auto resources =
playback.resources();
107 auto file = resources
112 decoderFailed(std::string(
"opening movie cannot be found: ") +
116 const bool bink = file->ends_with(
".bik");
121 data::Sequence2DBoundingBoxAttribute bounds{};
122 bounds.left =
bink ? 0 : 200;
123 bounds.top =
bink ? 0 : 150;
124 bounds.right =
bink ? 800 : 600;
125 bounds.bottom =
bink ? 600 : 450;
126 data::SequenceVideoData options{};
127 options.drawSolid =
true;
128 options.alphaLevel = 255;
129 options.enableVideo = options.enableAudio =
true;
130 options.drawDirectlyToScreen =
true;
132 *file, options, bounds,
bink);
147 const auto ending = started
149 : std::expected<void, std::string>{
150 std::unexpected(started.error())};
153 : std::expected<int, std::string>{
154 std::unexpected(
ending.error())};
158 while (
playback.commands().nestingLevel() > 0)
171 "opening movie start command produced no runtime node",
177 movie_ =
nodes.front();
178 movieFile_ = std::move(*file);
183 std::span<const video::SequencePlaybackState>
videoStates,
189 if (tick >= trademarkStarted_ && tick - trademarkStarted_ > 540)
197 [&](
const auto&
value) { return value.node == movie_; });
199 const bool live =
playback.runtime().inspect(movie_).has_value();
228 {
return std::exchange(selectionRequested_,
false); }
231 {
return std::exchange(error_, {}); }
void skip(engine::SequencePlayback &playback)
std::string takeError() noexcept
bool active() const noexcept
bool takePlayerSelectionRequest() noexcept
void begin(std::uint64_t tick, bool startedByLobby, bool use3DBoard, engine::SequencePlayback &playback)
void decoderFailed(std::string error, engine::SequencePlayback &playback)
void update(std::uint64_t tick, std::span< const video::SequencePlaybackState > videoStates, engine::SequencePlayback &playback)
void reset(engine::SequencePlayback &playback)
static std::expected< std::shared_ptr< const SequenceProgram >, RuntimeError > load(const data::DataSource &source, data::DataId id, std::size_t offset=0, DescriptionLimits limits={})
constexpr DataId EmptyDataId
constexpr DataId packDataId(std::uint16_t group, DataTag tag) noexcept