|
| 1 | +#include "Game/Util/RailGraphUtil.hpp" |
| 2 | +#include "Game/Map/RailGraph.hpp" |
| 3 | +#include "Game/Util/MathUtil.hpp" |
| 4 | + |
| 5 | +namespace MR { |
| 6 | + RailGraphIter* createRailGraphIter(const RailGraph* pGraph) { |
| 7 | + return new RailGraphIter(pGraph->getIterator()); |
| 8 | + } |
| 9 | + |
| 10 | + void moveNextNode(RailGraphIter* pIter) { |
| 11 | + pIter->moveNodeNext(); |
| 12 | + } |
| 13 | + |
| 14 | + void moveNodeNearPosition(RailGraphIter* pRailGraphIter, const TVec3f& rVec, f32 f, RailGraphNodeSelecter* pSelector) { |
| 15 | + pRailGraphIter->setNode(getNearNodeIndex(pRailGraphIter->mGraph, rVec, f, pSelector)); |
| 16 | + } |
| 17 | + |
| 18 | + void selectReverseEdge(RailGraphIter* pRailGraphIter) { |
| 19 | + s32 next = pRailGraphIter->mSelectedEdge; |
| 20 | + pRailGraphIter->moveNodeNext(); |
| 21 | + pRailGraphIter->selectEdge(next); |
| 22 | + } |
| 23 | + |
| 24 | + bool isSelectedEdge(const RailGraphIter* pRailGraphIter) { |
| 25 | + return pRailGraphIter->isSelectedEdge(); |
| 26 | + } |
| 27 | + |
| 28 | + bool isWatchedPrevEdge(const RailGraphIter* pRailGraphIter) { |
| 29 | + return pRailGraphIter->isWatchedPrevEdge(); |
| 30 | + } |
| 31 | + |
| 32 | + TVec3f* getCurrentNodePosition(const RailGraphIter* pGraph) { |
| 33 | + return &pGraph->getCurrentNode()->_0; |
| 34 | + } |
| 35 | + |
| 36 | + TVec3f* getNextNodePosition(const RailGraphIter* pIter) { |
| 37 | + return &pIter->getNextNode()->_0; |
| 38 | + } |
| 39 | + |
| 40 | + void calcWatchEdgeVector(const RailGraphIter* pIter, TVec3f* pEdge) { |
| 41 | + pEdge->set< f32 >(pIter->getWatchNode()->_0 - pIter->getCurrentNode()->_0); |
| 42 | + } |
| 43 | + |
| 44 | + void calcWatchEdgeDirection(const RailGraphIter* pRailGraphIter, TVec3f* pVec) { |
| 45 | + calcWatchEdgeVector(pRailGraphIter, pVec); |
| 46 | + MR::normalize(pVec); |
| 47 | + } |
| 48 | + |
| 49 | + // MR::getNearNodeIndex |
| 50 | + |
| 51 | + s32 getSelectEdgeArg0(const RailGraphIter* pIter) { |
| 52 | + return pIter->getCurrentEdge()->mPointArg0; |
| 53 | + } |
| 54 | + |
| 55 | + s32 getSelectEdgeArg1(const RailGraphIter* pIter) { |
| 56 | + return pIter->getCurrentEdge()->mPointArg1; |
| 57 | + } |
| 58 | + |
| 59 | + s32 getSelectEdgeArg2(const RailGraphIter* pIter) { |
| 60 | + return pIter->getCurrentEdge()->mPointArg2; |
| 61 | + } |
| 62 | + |
| 63 | + s32 getSelectEdgeArg3(const RailGraphIter* pIter) { |
| 64 | + return pIter->getCurrentEdge()->mPointArg3; |
| 65 | + } |
| 66 | + |
| 67 | + s32 getWatchEdgeArg7(const RailGraphIter* pIter) { |
| 68 | + return pIter->getWatchEdge()->mPointArg7; |
| 69 | + } |
| 70 | + |
| 71 | +}; // namespace MR |
0 commit comments