mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-01-22 07:32:07 -05:00
separate dynos pack model and mod owned model ids
to address the grand star late join model bug that can happen with mods like omm. the bug happened when players have different dynos packs, and during a late join, the model ids are relied on to be the same. dynos packs can offset the available model ids, therefore desyncing the model used on late join.
This commit is contained in:
parent
b2137ca2ae
commit
92fbe54ebd
2 changed files with 13 additions and 10 deletions
|
@ -180,12 +180,14 @@ void DynOS_Actor_Override_All(void) {
|
||||||
for (s32 list : { OBJ_LIST_PLAYER, OBJ_LIST_DESTRUCTIVE, OBJ_LIST_GENACTOR, OBJ_LIST_PUSHABLE, OBJ_LIST_LEVEL, OBJ_LIST_DEFAULT, OBJ_LIST_SURFACE, OBJ_LIST_POLELIKE, OBJ_LIST_UNIMPORTANT }) {
|
for (s32 list : { OBJ_LIST_PLAYER, OBJ_LIST_DESTRUCTIVE, OBJ_LIST_GENACTOR, OBJ_LIST_PUSHABLE, OBJ_LIST_LEVEL, OBJ_LIST_DEFAULT, OBJ_LIST_SURFACE, OBJ_LIST_POLELIKE, OBJ_LIST_UNIMPORTANT }) {
|
||||||
struct Object *_Head = (struct Object *) &gObjectLists[list];
|
struct Object *_Head = (struct Object *) &gObjectLists[list];
|
||||||
for (struct Object *_Object = (struct Object *) _Head->header.next; _Object != _Head; _Object = (struct Object *) _Object->header.next) {
|
for (struct Object *_Object = (struct Object *) _Head->header.next; _Object != _Head; _Object = (struct Object *) _Object->header.next) {
|
||||||
if (_Object->header.gfx.sharedChild != NULL && _Object->header.gfx.sharedChild->georef != NULL) {
|
if (_Object->activeFlags && _Object->header.gfx.sharedChild != NULL) {
|
||||||
GraphNode* georef = (GraphNode*)_Object->header.gfx.sharedChild->georef;
|
if (_Object->header.gfx.sharedChild->georef != NULL) {
|
||||||
u32 id = 0;
|
GraphNode* georef = (GraphNode*)_Object->header.gfx.sharedChild->georef;
|
||||||
_Object->header.gfx.sharedChild = DynOS_Model_LoadGeo(&id, MODEL_POOL_PERMANENT, georef, true);
|
u32 id = 0;
|
||||||
|
_Object->header.gfx.sharedChild = DynOS_Model_LoadGeo(&id, MODEL_POOL_PERMANENT, georef, true);
|
||||||
|
}
|
||||||
|
DynOS_Actor_Override(_Object, (void**)&_Object->header.gfx.sharedChild);
|
||||||
}
|
}
|
||||||
DynOS_Actor_Override(_Object, (void**)&_Object->header.gfx.sharedChild);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,14 +29,15 @@ static std::map<void*, struct ModelInfo> sAssetMap[MODEL_POOL_MAX];
|
||||||
static std::map<u32, std::vector<struct ModelInfo>> sIdMap;
|
static std::map<u32, std::vector<struct ModelInfo>> sIdMap;
|
||||||
static std::map<u32, u32> sOverwriteMap;
|
static std::map<u32, u32> sOverwriteMap;
|
||||||
|
|
||||||
static u32 find_empty_id() {
|
static u32 find_empty_id(bool aIsPermanent) {
|
||||||
u32 id = VANILLA_ID_END + 1;
|
u32 id = aIsPermanent ? 9999 : VANILLA_ID_END + 1;
|
||||||
|
s8 dir = aIsPermanent ? -1 : 1;
|
||||||
while (true) {
|
while (true) {
|
||||||
if (id != 0) {
|
if (id != 9999) {
|
||||||
if (sIdMap.count(id) == 0) { return id; }
|
if (sIdMap.count(id) == 0) { return id; }
|
||||||
if (sIdMap[id].size() == 0) { return id; }
|
if (sIdMap[id].size() == 0) { return id; }
|
||||||
}
|
}
|
||||||
id++;
|
id += dir;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,7 +107,7 @@ struct GraphNode* DynOS_Model_LoadCommon(u32* aId, enum ModelPool aModelPool, vo
|
||||||
if (!node) { return NULL; }
|
if (!node) { return NULL; }
|
||||||
|
|
||||||
// figure out id
|
// figure out id
|
||||||
if (!*aId) { *aId = find_empty_id(); }
|
if (!*aId) { *aId = find_empty_id(aModelPool == MODEL_POOL_PERMANENT); }
|
||||||
|
|
||||||
// create model info
|
// create model info
|
||||||
struct ModelInfo info = {
|
struct ModelInfo info = {
|
||||||
|
|
Loading…
Reference in a new issue