2016-04-13 06:07:23 +00:00
|
|
|
#include "CTransitionDatabaseGame.hpp"
|
|
|
|
#include "CTransition.hpp"
|
|
|
|
#include "CHalfTransition.hpp"
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
namespace urde {
|
2016-04-13 06:07:23 +00:00
|
|
|
|
|
|
|
CTransitionDatabaseGame::CTransitionDatabaseGame(const std::vector<CTransition>& transitions,
|
|
|
|
const std::vector<CHalfTransition>& halfTransitions,
|
|
|
|
const std::shared_ptr<IMetaTrans>& defaultTrans)
|
2018-12-08 05:30:43 +00:00
|
|
|
: x10_defaultTrans(defaultTrans) {
|
|
|
|
x14_transitions.reserve(transitions.size());
|
|
|
|
for (const CTransition& trans : transitions)
|
|
|
|
x14_transitions.emplace_back(trans.GetAnimPair(), trans.GetMetaTrans());
|
2016-04-13 06:07:23 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
x24_halfTransitions.reserve(halfTransitions.size());
|
|
|
|
for (const CHalfTransition& trans : halfTransitions)
|
|
|
|
x24_halfTransitions.emplace_back(trans.GetId(), trans.GetMetaTrans());
|
2016-04-13 06:07:23 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
const std::shared_ptr<IMetaTrans>& CTransitionDatabaseGame::GetMetaTrans(u32 a, u32 b) const {
|
|
|
|
auto it = std::find_if(x14_transitions.cbegin(), x14_transitions.cend(),
|
|
|
|
[&](const std::pair<std::pair<u32, u32>, std::shared_ptr<IMetaTrans>>& elem) -> bool {
|
|
|
|
return elem.first.first == a && elem.first.second == b;
|
|
|
|
});
|
|
|
|
if (it != x14_transitions.cend())
|
|
|
|
return it->second;
|
|
|
|
return x10_defaultTrans;
|
2016-04-13 06:07:23 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
} // namespace urde
|