summaryrefslogtreecommitdiff
path: root/src/KingSystem/Event/evtResourceTimeline.h
blob: 21361ecb5b9d198aceed46d689413efaf2799e9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#pragma once

#include <container/seadBuffer.h>
#include <prim/seadSafeString.h>
#include "KingSystem/Resource/resHandle.h"

namespace al {
class ByamlIter;
}

namespace evfl {
struct ResEventFlowFile;
struct ResTimeline;
class TimelineObj;
}  // namespace evfl

namespace ksys::evt {

class ActorBindings;

class ResourceTimeline {
public:
    ResourceTimeline();
    virtual ~ResourceTimeline();

    /// Loads event timeline resource files asynchronously.
    void loadEventFlow(sead::Heap* heap, const al::ByamlIter& event_info, res::Handle* pack_handle);

    /// @return true if the load completed (succeeded or failed), false if it is still ongoing.
    bool finishLoad();

    /// @return whether at least one actor was bound.
    bool setUpBindings(ActorBindings* bindings, sead::Heap* heap);

    /// @return whether the build was successful.
    bool buildTimeline(evfl::TimelineObj* obj, int idx, sead::Heap* heap);

private:
    struct Res {
        res::Handle handle;
        const evfl::ResEventFlowFile* res_event_flow_file;
        const evfl::ResTimeline* res_timeline;
        bool loaded;
    };

    sead::Buffer<Res> mTimelines;
    bool mLoadFailed;
    sead::FixedSafeString<64> mName;
};

}  // namespace ksys::evt