finish up the remaining RailGraph functions

This commit is contained in:
shibbo 2022-01-28 02:51:00 -05:00
parent 2141469f80
commit 42c540b73a
9 changed files with 153 additions and 29 deletions

View File

@ -1168,15 +1168,15 @@ init__8RaceRailFRC12JMapInfoIter,RaceRail.o,Map.a,false
initRacer__11PlayerRacerFv,RaceRail.o,Map.a,false
prepRacer__11PlayerRacerFPC11RaceManager,RaceRail.o,Map.a,false
resetRacer__11PlayerRacerFPC11RaceManager,RaceRail.o,Map.a,false
__ct__9RailGraphFv,RailGraph.o,Map.a,false
addNode__9RailGraphFRCQ29JGeometry8TVec3<f>,RailGraph.o,Map.a,false
connectNodeTwoWay__9RailGraphFllPC13RailGraphEdge,RailGraph.o,Map.a,false
__as__13RailGraphEdgeFRC13RailGraphEdge,RailGraph.o,Map.a,false
getNode__9RailGraphCFl,RailGraph.o,Map.a,false
getEdge__9RailGraphCFl,RailGraph.o,Map.a,false
isValidEdge__9RailGraphCFl,RailGraph.o,Map.a,false
connectEdgeToNode__9RailGraphFll,RailGraph.o,Map.a,false
getIterator__9RailGraphCFv,RailGraph.o,Map.a,false
__ct__9RailGraphFv,RailGraph.o,Map.a,true
addNode__9RailGraphFRCQ29JGeometry8TVec3<f>,RailGraph.o,Map.a,true
connectNodeTwoWay__9RailGraphFllPC13RailGraphEdge,RailGraph.o,Map.a,true
__as__13RailGraphEdgeFRC13RailGraphEdge,RailGraph.o,Map.a,true
getNode__9RailGraphCFl,RailGraph.o,Map.a,true
getEdge__9RailGraphCFl,RailGraph.o,Map.a,true
isValidEdge__9RailGraphCFl,RailGraph.o,Map.a,true
connectEdgeToNode__9RailGraphFll,RailGraph.o,Map.a,true
getIterator__9RailGraphCFv,RailGraph.o,Map.a,true
__ct__13RailGraphEdgeFv,RailGraphEdge.o,Map.a,true
clearConnectInfo__13RailGraphEdgeFv,RailGraphEdge.o,Map.a,true
getNextNode__13RailGraphEdgeCFl,RailGraphEdge.o,Map.a,true
@ -1198,7 +1198,7 @@ getNextNode__13RailGraphIterCFv,RailGraphIter.o,Map.a,true
getWatchNode__13RailGraphIterCFv,RailGraphIter.o,Map.a,true
getCurrentEdge__13RailGraphIterCFv,RailGraphIter.o,Map.a,true
getWatchEdge__13RailGraphIterCFv,RailGraphIter.o,Map.a,true
__ct__13RailGraphNodeFv,RailGraphNode.o,Map.a,false
__ct__13RailGraphNodeFv,RailGraphNode.o,Map.a,true
epsilonEquals__Q29JGeometry8TVec3<f>CFRCQ29JGeometry8TVec3<f>f,RailPart.o,Map.a,false
__ct__8RailPartFv,RailPart.o,Map.a,true
init__8RailPartFRCQ29JGeometry8TVec3<f>RCQ29JGeometry8TVec3<f>RCQ29JGeometry8TVec3<f>RCQ29JGeometry8TVec3<f>,RailPart.o,Map.a,true

1 Symbol Name Object File Library Archive Matching
1168 initRacer__11PlayerRacerFv RaceRail.o Map.a false
1169 prepRacer__11PlayerRacerFPC11RaceManager RaceRail.o Map.a false
1170 resetRacer__11PlayerRacerFPC11RaceManager RaceRail.o Map.a false
1171 __ct__9RailGraphFv RailGraph.o Map.a false true
1172 addNode__9RailGraphFRCQ29JGeometry8TVec3<f> RailGraph.o Map.a false true
1173 connectNodeTwoWay__9RailGraphFllPC13RailGraphEdge RailGraph.o Map.a false true
1174 __as__13RailGraphEdgeFRC13RailGraphEdge RailGraph.o Map.a false true
1175 getNode__9RailGraphCFl RailGraph.o Map.a false true
1176 getEdge__9RailGraphCFl RailGraph.o Map.a false true
1177 isValidEdge__9RailGraphCFl RailGraph.o Map.a false true
1178 connectEdgeToNode__9RailGraphFll RailGraph.o Map.a false true
1179 getIterator__9RailGraphCFv RailGraph.o Map.a false true
1180 __ct__13RailGraphEdgeFv RailGraphEdge.o Map.a true
1181 clearConnectInfo__13RailGraphEdgeFv RailGraphEdge.o Map.a true
1182 getNextNode__13RailGraphEdgeCFl RailGraphEdge.o Map.a true
1198 getWatchNode__13RailGraphIterCFv RailGraphIter.o Map.a true
1199 getCurrentEdge__13RailGraphIterCFv RailGraphIter.o Map.a true
1200 getWatchEdge__13RailGraphIterCFv RailGraphIter.o Map.a true
1201 __ct__13RailGraphNodeFv RailGraphNode.o Map.a false true
1202 epsilonEquals__Q29JGeometry8TVec3<f>CFRCQ29JGeometry8TVec3<f>f RailPart.o Map.a false
1203 __ct__8RailPartFv RailPart.o Map.a true
1204 init__8RailPartFRCQ29JGeometry8TVec3<f>RCQ29JGeometry8TVec3<f>RCQ29JGeometry8TVec3<f>RCQ29JGeometry8TVec3<f> RailPart.o Map.a true

View File

@ -1,6 +1,6 @@
{
"schemaVersion": 1,
"label": "decompiled",
"message": "4.838341714469108%",
"message": "4.861348753849812%",
"color": "blue"
}

View File

@ -11,7 +11,7 @@
| [GameAudio](https://github.com/shibbo/Petari/blob/master/docs/lib/GameAudio.md) | 0.0% |
| [Gravity](https://github.com/shibbo/Petari/blob/master/docs/lib/Gravity.md) | 56.286937028734464% |
| [LiveActor](https://github.com/shibbo/Petari/blob/master/docs/lib/LiveActor.md) | 35.83679114799447% |
| [Map](https://github.com/shibbo/Petari/blob/master/docs/lib/Map.md) | 10.92789631032626% |
| [Map](https://github.com/shibbo/Petari/blob/master/docs/lib/Map.md) | 11.369840120327558% |
| [MapObj](https://github.com/shibbo/Petari/blob/master/docs/lib/MapObj.md) | 3.201281344579767% |
| [NameObj](https://github.com/shibbo/Petari/blob/master/docs/lib/NameObj.md) | 21.12676056338028% |
| [NPC](https://github.com/shibbo/Petari/blob/master/docs/lib/NPC.md) | 0.7591369440774989% |

View File

@ -57,10 +57,10 @@
| QuakeEffectGenerator.o | 0.0% | 0 / 12 | 0.0% |
| RaceManager.o | 0.0% | 0 / 95 | 0.0% |
| RaceRail.o | 0.0% | 0 / 23 | 0.0% |
| RailGraph.o | 0.0% | 0 / 9 | 0.0% |
| RailGraph.o | 100.0% | 9 / 9 | 100.0% |
| RailGraphEdge.o | 100.0% | 6 / 6 | 100.0% |
| RailGraphIter.o | 100.0% | 15 / 15 | 100.0% |
| RailGraphNode.o | 0.0% | 0 / 1 | 0.0% |
| RailGraphNode.o | 100.0% | 1 / 1 | 100.0% |
| RailPart.o | 60.0% | 9 / 12 | 75.0% |
| ScenarioSelectStar.o | 0.0% | 0 / 37 | 0.0% |
| SeaGull.o | 54.52127659574468% | 17 / 20 | 85.0% |
@ -1537,15 +1537,15 @@
# RailGraph.o
| Symbol | Decompiled? |
| ------------- | ------------- |
| __ct__9RailGraphFv | :x: |
| addNode__9RailGraphFRCQ29JGeometry8TVec3&lt;f&gt; | :x: |
| connectNodeTwoWay__9RailGraphFllPC13RailGraphEdge | :x: |
| __as__13RailGraphEdgeFRC13RailGraphEdge | :x: |
| getNode__9RailGraphCFl | :x: |
| getEdge__9RailGraphCFl | :x: |
| isValidEdge__9RailGraphCFl | :x: |
| connectEdgeToNode__9RailGraphFll | :x: |
| getIterator__9RailGraphCFv | :x: |
| __ct__9RailGraphFv | :white_check_mark: |
| addNode__9RailGraphFRCQ29JGeometry8TVec3&lt;f&gt; | :white_check_mark: |
| connectNodeTwoWay__9RailGraphFllPC13RailGraphEdge | :white_check_mark: |
| __as__13RailGraphEdgeFRC13RailGraphEdge | :white_check_mark: |
| getNode__9RailGraphCFl | :white_check_mark: |
| getEdge__9RailGraphCFl | :white_check_mark: |
| isValidEdge__9RailGraphCFl | :white_check_mark: |
| connectEdgeToNode__9RailGraphFll | :white_check_mark: |
| getIterator__9RailGraphCFv | :white_check_mark: |
# RailGraphEdge.o
@ -1582,7 +1582,7 @@
# RailGraphNode.o
| Symbol | Decompiled? |
| ------------- | ------------- |
| __ct__13RailGraphNodeFv | :x: |
| __ct__13RailGraphNodeFv | :white_check_mark: |
# RailPart.o

View File

@ -1,5 +1,6 @@
#pragma once
#include "JSystem/JGeometry.h"
#include <revolution.h>
class RailGraphIter;
@ -8,16 +9,20 @@ class RailGraphEdge;
class RailGraph {
public:
RailGraph();
s32 addNode(const TVec3f &);
void connectNodeTwoWay(s32, s32, const RailGraphEdge *);
RailGraphNode* getNode(s32) const;
RailGraphEdge* getEdge(s32) const;
bool isValidEdge(s32) const;
void connectEdgeToNode(s32, s32);
RailGraphIter* getIterator() const;
RailGraphIter getIterator() const;
RailGraphNode* mNodes; // _0
s32 mNodeCount; // _4
u32 _8;
RailGraphEdge* mEdges; // _C
s32 mEdgeCount; // _10
u32 _14;
s32 _14;
};

View File

@ -14,6 +14,22 @@ public:
void setNextEdge(s32, s32);
void setArgs(const JMapInfo *, s32);
void operator=(const RailGraphEdge &rEdge) {
mDistance = rEdge.mDistance;
_4 = rEdge._4;
_8 = rEdge._8;
_C = rEdge._C;
_10 = rEdge._10;
mPointArg0 = rEdge.mPointArg0;
mPointArg1 = rEdge.mPointArg1;
mPointArg2 = rEdge.mPointArg2;
mPointArg3 = rEdge.mPointArg3;
mPointArg4 = rEdge.mPointArg4;
mPointArg5 = rEdge.mPointArg5;
mPointArg6 = rEdge.mPointArg6;
mPointArg7 = rEdge.mPointArg7;
}
f32 mDistance; // _0
s32 _4;
s32 _8;

View File

@ -1,14 +1,13 @@
#pragma once
#include "JSystem/JGeometry.h"
#include <revolution.h>
class RailGraphNode {
public:
RailGraphNode();
f32 _0;
f32 _4;
f32 _8;
TVec3f _0;
s32 _C;
u32 _10;
};

View File

@ -0,0 +1,95 @@
#include "Game/Map/RailGraph.h"
#include "Game/Map/RailGraphEdge.h"
#include "Game/Map/RailGraphIter.h"
#include "Game/Map/RailGraphNode.h"
RailGraph::RailGraph() {
mNodes = 0;
mNodeCount = 0;
_8 = 0;
mEdges = 0;
mEdgeCount = 0;
_14 = 0;
mNodes = new RailGraphNode[0x100];
mNodeCount = 0x100;
mEdges = new RailGraphEdge[0x100];
mEdgeCount = 0x200;
}
s32 RailGraph::addNode(const TVec3f &rVec) {
RailGraphNode node;
node._0.x = rVec.x;
node._0.y = rVec.y;
node._0.z = rVec.z;
s32 cnt = _8;
_8 = cnt + 1;
RailGraphNode* nodes = &mNodes[cnt];
nodes->_0.setInlinePS(node._0);
nodes->_C = node._C;
nodes->_10 = node._10;
return _8 - 1;
}
void RailGraph::connectNodeTwoWay(s32 a1, s32 a2, const RailGraphEdge *pEdge) {
RailGraphEdge edge;
if (pEdge) {
edge = *pEdge;
}
edge.clearConnectInfo();
edge._4 = a1;
edge._8 = a2;
edge.mDistance = PSVECDistance((const Vec*)&mNodes[a1]._0, (const Vec*)&mNodes[a2]._0);
s32 cnt = _14;
_14 = cnt + 1;
mEdges[cnt] = edge;
s32 edgeIdx = _14 - 1;
connectEdgeToNode(a1, edgeIdx);
connectEdgeToNode(a2, edgeIdx);
}
RailGraphNode* RailGraph::getNode(s32 idx) const {
return &mNodes[idx];
}
RailGraphEdge* RailGraph::getEdge(s32 idx) const {
return &mEdges[idx];
}
bool RailGraph::isValidEdge(s32 edgeIdx) const {
bool ret = false;
if (edgeIdx >= 0 && edgeIdx < _14) {
ret = true;
}
return ret;
}
void RailGraph::connectEdgeToNode(s32 a1, s32 a2) {
RailGraphNode* node = &mNodes[a1];
s32 val = node->_C;
if (val == -1) {
node->_C = a2;
}
else {
s32 next_edge = mEdges[val].getNextEdge(a1);
while (next_edge != -1) {
val = next_edge;
next_edge = mEdges[next_edge].getNextEdge(a1);
}
mEdges[val].setNextEdge(a2, a1);
}
mNodes[a1]._10++;
}
RailGraphIter RailGraph::getIterator() const {
return RailGraphIter(this);
}

View File

@ -0,0 +1,9 @@
#include "Game/Map/RailGraphNode.h"
RailGraphNode::RailGraphNode() {
_C = -1;
_0.x = 0.0f;
_0.y = 0.0f;
_0.z = 0.0f;
_10 = 0;
}