mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-21 19:45:10 +00:00
Make objects look up their original model id on late join
This commit is contained in:
parent
fbd55651ad
commit
ce044fcb69
1 changed files with 24 additions and 3 deletions
|
@ -163,16 +163,37 @@ struct GraphNode* DynOS_Model_GetGeo(u32 aId) {
|
||||||
return vec.back().graphNode;
|
return vec.back().graphNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 DynOS_Model_GetIdFromGraphNode(struct GraphNode* aNode) {
|
static u32 DynOS_Model_GetIdFromGeoRef(u32 aIndex, void* aGeoRef) {
|
||||||
u32 lowest = 9999;
|
u32 lowest = 9999;
|
||||||
for (auto& it : sIdMap) {
|
for (auto& it : sIdMap) {
|
||||||
if (it.first > lowest) { continue; }
|
u32 id = it.first;
|
||||||
|
if (id > lowest) { continue; }
|
||||||
|
if (!it.second.size() || it.second.empty()) { continue; }
|
||||||
|
auto& node = it.second.back();
|
||||||
|
if (aGeoRef == node.graphNode->georef) {
|
||||||
|
lowest = id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (lowest < 9999) { return lowest; }
|
||||||
|
return aIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 DynOS_Model_GetIdFromGraphNode(struct GraphNode* aNode) {
|
||||||
|
u32 lowest = 9999;
|
||||||
|
void* georef = NULL;
|
||||||
|
for (auto& it : sIdMap) {
|
||||||
|
u32 id = it.first;
|
||||||
|
if (id > lowest) { continue; }
|
||||||
if (!it.second.size() || it.second.empty()) { continue; }
|
if (!it.second.size() || it.second.empty()) { continue; }
|
||||||
auto& node = it.second.back();
|
auto& node = it.second.back();
|
||||||
if (aNode == node.graphNode) {
|
if (aNode == node.graphNode) {
|
||||||
lowest = it.first;
|
lowest = id;
|
||||||
|
georef = (void*)node.graphNode->georef;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (georef) {
|
||||||
|
lowest = DynOS_Model_GetIdFromGeoRef(lowest, georef);
|
||||||
|
}
|
||||||
if (lowest < 9999) { return lowest; }
|
if (lowest < 9999) { return lowest; }
|
||||||
return MODEL_ERROR_MODEL;
|
return MODEL_ERROR_MODEL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue