75 lines
3.3 KiB
C++
75 lines
3.3 KiB
C++
#pragma once
|
|
|
|
#include "gc/RvbScene.hpp"
|
|
|
|
#include <array>
|
|
#include <cstdint>
|
|
#include <limits>
|
|
#include <string>
|
|
#include <unordered_map>
|
|
#include <vector>
|
|
|
|
namespace gc {
|
|
|
|
struct RvbImageDraw {
|
|
std::string imageSymbol;
|
|
std::string instancePath;
|
|
// top-left, top-right, bottom-left, bottom-right in the RVB canvas
|
|
std::array<std::array<float, 2>, 4> corners{};
|
|
std::array<float, 3> color{1.0f, 1.0f, 1.0f};
|
|
float alpha = 1.0f;
|
|
uint32_t depth = 0;
|
|
};
|
|
|
|
// A Flash-style MovieClip path mapped to the labeled frame that should be
|
|
// visible. Paths are the same absolute paths exported in PREP ("/" is the
|
|
// root timeline). Clips not mentioned here remain on their first FRAM.
|
|
struct RvbSnapshotState {
|
|
std::unordered_map<std::string, std::string> frameByPath;
|
|
// Frame offset after a labeled play() entry point. The default resolves
|
|
// to the following stop(), preserving the static snapshot behavior.
|
|
uint32_t animationFrame = std::numeric_limits<uint32_t>::max();
|
|
// Optional per-clip overrides allow a transition to advance while child
|
|
// loops and unrelated state clips remain at their authored stop frames.
|
|
std::unordered_map<std::string, uint32_t> animationFrameByPath;
|
|
bool includeRootOther = false;
|
|
};
|
|
|
|
// Builds the display list produced by the first frame of the root timeline
|
|
// and the first frame of every placed MovieClip. This is the exact static
|
|
// base of the original scene; later timeline frames and ActionScript state
|
|
// changes can be layered on top as their opcodes are recovered.
|
|
bool BuildRvbInitialSnapshot(const std::vector<uint8_t>& bytes,
|
|
const RvbScene& scene,
|
|
std::vector<RvbImageDraw>* draws,
|
|
std::string* error = nullptr);
|
|
|
|
// Builds the display list at selected labeled frames. RVB FRAM records are
|
|
// deltas, so this applies PLC3/RMOV commands in order through each requested
|
|
// frame instead of treating a frame as a self-contained draw list.
|
|
bool BuildRvbSnapshot(const std::vector<uint8_t>& bytes,
|
|
const RvbScene& scene,
|
|
const RvbSnapshotState& state,
|
|
std::vector<RvbImageDraw>* draws,
|
|
std::string* error = nullptr);
|
|
|
|
// Returns the longest play()..stop() span selected by this state. The result
|
|
// includes the labeled entry frame and can be converted to seconds with the
|
|
// scene frame rate.
|
|
uint32_t MeasureRvbSnapshotAnimationFrames(const std::vector<uint8_t>& bytes,
|
|
const RvbScene& scene,
|
|
const RvbSnapshotState& state,
|
|
std::string* error = nullptr);
|
|
|
|
// Builds an exported/linkage MovieClip without requiring it to be placed on
|
|
// the root timeline. game471.exe uses this path for the twelve dynamically
|
|
// instantiated select-music rows (mc_music_link / mc_index_link).
|
|
bool BuildRvbSymbolSnapshot(const std::vector<uint8_t>& bytes,
|
|
const RvbScene& scene,
|
|
const std::string& symbolName,
|
|
const RvbSnapshotState& state,
|
|
std::vector<RvbImageDraw>* draws,
|
|
std::string* error = nullptr);
|
|
|
|
} // namespace gc
|