mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-25 05:25:14 +00:00
Prevent deduplication of area models - it would overwrite the areaIndex
This commit is contained in:
parent
b0408a1379
commit
cf7d4bc8d2
8 changed files with 16 additions and 16 deletions
|
@ -72,7 +72,7 @@ const char *dynos_behavior_get_token(BehaviorScript *bhvScript, u32 index);
|
|||
void dynos_behavior_hook_all_custom_behaviors(void);
|
||||
|
||||
// -- models -- //
|
||||
struct GraphNode* dynos_model_load_geo(u32* aId, enum ModelPool aModelPool, void* aAsset);
|
||||
struct GraphNode* dynos_model_load_geo(u32* aId, enum ModelPool aModelPool, void* aAsset, bool aDeDuplicate);
|
||||
struct GraphNode* dynos_model_load_dl(u32* aId, enum ModelPool aModelPool, u8 aLayer, void* aAsset);
|
||||
struct GraphNode* dynos_model_store_geo(u32* aId, enum ModelPool aModelPool, void* aAsset, struct GraphNode* aGraphNode);
|
||||
struct GraphNode* dynos_model_get_geo(u32 aId);
|
||||
|
|
|
@ -963,7 +963,7 @@ void DynOS_MovtexQC_ModShutdown();
|
|||
// Model Manager
|
||||
//
|
||||
|
||||
struct GraphNode* DynOS_Model_LoadGeo(u32* aId, enum ModelPool aModelPool, void* aAsset);
|
||||
struct GraphNode* DynOS_Model_LoadGeo(u32* aId, enum ModelPool aModelPool, void* aAsset, bool aDeDuplicate);
|
||||
struct GraphNode* DynOS_Model_LoadDl(u32* aId, enum ModelPool aModelPool, u8 aLayer, void* aAsset);
|
||||
struct GraphNode* DynOS_Model_StoreGeo(u32* aId, enum ModelPool aModelPool, void* aAsset, struct GraphNode* aGraphNode);
|
||||
struct GraphNode* DynOS_Model_GetGeo(u32 aId);
|
||||
|
|
|
@ -225,8 +225,8 @@ void dynos_behavior_hook_all_custom_behaviors(void) {
|
|||
|
||||
// -- models -- //
|
||||
|
||||
struct GraphNode* dynos_model_load_geo(u32* aId, enum ModelPool aModelPool, void* aAsset) {
|
||||
return DynOS_Model_LoadGeo(aId, aModelPool, aAsset);
|
||||
struct GraphNode* dynos_model_load_geo(u32* aId, enum ModelPool aModelPool, void* aAsset, bool aDeDuplicate) {
|
||||
return DynOS_Model_LoadGeo(aId, aModelPool, aAsset, aDeDuplicate);
|
||||
}
|
||||
|
||||
struct GraphNode* dynos_model_load_dl(u32* aId, enum ModelPool aModelPool, u8 aLayer, void* aAsset) {
|
||||
|
|
|
@ -50,7 +50,7 @@ void DynOS_Actor_AddCustom(const SysPath &aFilename, const char *aActorName) {
|
|||
ActorGfx actorGfx = { };
|
||||
actorGfx.mGfxData = _GfxData;
|
||||
actorGfx.mPackIndex = MOD_PACK_INDEX;
|
||||
actorGfx.mGraphNode = (GraphNode *) DynOS_Model_LoadGeo(&id, MODEL_POOL_SESSION, geoLayout);
|
||||
actorGfx.mGraphNode = (GraphNode *) DynOS_Model_LoadGeo(&id, MODEL_POOL_SESSION, geoLayout, true);
|
||||
if (!actorGfx.mGraphNode) {
|
||||
Print(" ERROR: Couldn't load graph node for \"%s\"", actorName);
|
||||
free(actorName);
|
||||
|
@ -170,7 +170,7 @@ void DynOS_Actor_Override_All(void) {
|
|||
if (_Object->header.gfx.sharedChild != NULL && _Object->header.gfx.sharedChild->georef != NULL) {
|
||||
GraphNode* georef = (GraphNode*)_Object->header.gfx.sharedChild->georef;
|
||||
u32 id = 0;
|
||||
_Object->header.gfx.sharedChild = DynOS_Model_LoadGeo(&id, MODEL_POOL_PERMANENT, georef);
|
||||
_Object->header.gfx.sharedChild = DynOS_Model_LoadGeo(&id, MODEL_POOL_PERMANENT, georef, true);
|
||||
}
|
||||
DynOS_Actor_Override((void**)&_Object->header.gfx.sharedChild);
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ void DynOS_Model_Dump() {
|
|||
}
|
||||
}
|
||||
|
||||
struct GraphNode* DynOS_Model_LoadCommon(u32* aId, enum ModelPool aModelPool, void* aAsset, u8 aLayer, struct GraphNode* aGraphNode, enum ModelLoadType mlt) {
|
||||
struct GraphNode* DynOS_Model_LoadCommon(u32* aId, enum ModelPool aModelPool, void* aAsset, u8 aLayer, struct GraphNode* aGraphNode, bool aDeDuplicate, enum ModelLoadType mlt) {
|
||||
// sanity check pool
|
||||
if (aModelPool >= MODEL_POOL_MAX) { return NULL; }
|
||||
|
||||
|
@ -64,7 +64,7 @@ struct GraphNode* DynOS_Model_LoadCommon(u32* aId, enum ModelPool aModelPool, vo
|
|||
|
||||
// check map
|
||||
auto& map = sAssetMap[aModelPool];
|
||||
if (map.count(aAsset)) {
|
||||
if (aDeDuplicate && map.count(aAsset)) {
|
||||
auto& found = map[aAsset];
|
||||
if (*aId && *aId != found.id) {
|
||||
sOverwriteMap[*aId] = found.id;
|
||||
|
@ -106,16 +106,16 @@ struct GraphNode* DynOS_Model_LoadCommon(u32* aId, enum ModelPool aModelPool, vo
|
|||
return node;
|
||||
}
|
||||
|
||||
struct GraphNode* DynOS_Model_LoadGeo(u32* aId, enum ModelPool aModelPool, void* aAsset) {
|
||||
return DynOS_Model_LoadCommon(aId, aModelPool, aAsset, 0, NULL, MLT_GEO);
|
||||
struct GraphNode* DynOS_Model_LoadGeo(u32* aId, enum ModelPool aModelPool, void* aAsset, bool aDeDuplicate) {
|
||||
return DynOS_Model_LoadCommon(aId, aModelPool, aAsset, 0, NULL, aDeDuplicate, MLT_GEO);
|
||||
}
|
||||
|
||||
struct GraphNode* DynOS_Model_LoadDl(u32* aId, enum ModelPool aModelPool, u8 aLayer, void* aAsset) {
|
||||
return DynOS_Model_LoadCommon(aId, aModelPool, aAsset, aLayer, NULL, MLT_DL);
|
||||
return DynOS_Model_LoadCommon(aId, aModelPool, aAsset, aLayer, NULL, true, MLT_DL);
|
||||
}
|
||||
|
||||
struct GraphNode* DynOS_Model_StoreGeo(u32* aId, enum ModelPool aModelPool, void* aAsset, struct GraphNode* aGraphNode) {
|
||||
return DynOS_Model_LoadCommon(aId, aModelPool, aAsset, 0, aGraphNode, MLT_STORE);
|
||||
return DynOS_Model_LoadCommon(aId, aModelPool, aAsset, 0, aGraphNode, true, MLT_STORE);
|
||||
}
|
||||
|
||||
struct GraphNode* DynOS_Model_GetErrorGeo() {
|
||||
|
|
|
@ -43,7 +43,7 @@ static void DynOS_Pack_ActivateActor(s32 aPackIndex, Pair<const char *, GfxData
|
|||
|
||||
auto& geoNode = *(aGfxData->mGeoLayouts.end() - 1);
|
||||
u32 id = 0;
|
||||
GraphNode* graphNode = DynOS_Model_LoadGeo(&id, MODEL_POOL_PERMANENT, geoNode->mData);
|
||||
GraphNode* graphNode = DynOS_Model_LoadGeo(&id, MODEL_POOL_PERMANENT, geoNode->mData, true);
|
||||
if (graphNode == NULL) { return; }
|
||||
|
||||
const void* georef = DynOS_Builtin_Actor_GetFromName(aActorName);
|
||||
|
|
|
@ -423,7 +423,7 @@ static void level_cmd_begin_area(void) {
|
|||
|
||||
if (areaIndex < 8) {
|
||||
u32 id = 0;
|
||||
struct GraphNodeRoot *screenArea = (struct GraphNodeRoot *) dynos_model_load_geo(&id, MODEL_POOL_LEVEL, geoLayoutAddr);
|
||||
struct GraphNodeRoot *screenArea = (struct GraphNodeRoot *) dynos_model_load_geo(&id, MODEL_POOL_LEVEL, geoLayoutAddr, false);
|
||||
struct GraphNodeCamera *node = (struct GraphNodeCamera *) screenArea->views[0];
|
||||
|
||||
sCurrAreaIndex = areaIndex;
|
||||
|
@ -464,7 +464,7 @@ static void level_cmd_load_model_from_geo(void) {
|
|||
void *arg1 = CMD_GET(void *, 4);
|
||||
|
||||
u32 id = arg0;
|
||||
dynos_model_load_geo(&id, sFinishedLoadingPerm ? MODEL_POOL_LEVEL : MODEL_POOL_PERMANENT, arg1);
|
||||
dynos_model_load_geo(&id, sFinishedLoadingPerm ? MODEL_POOL_LEVEL : MODEL_POOL_PERMANENT, arg1, true);
|
||||
|
||||
sCurrentCmd = CMD_NEXT;
|
||||
}
|
||||
|
|
|
@ -488,7 +488,7 @@ u16 smlua_model_util_load(enum ModelExtendedId extId) {
|
|||
if (info->isDisplayList) {
|
||||
dynos_model_load_dl(&id, MODEL_POOL_SESSION, info->layer, (void*)info->asset);
|
||||
} else {
|
||||
dynos_model_load_geo(&id, MODEL_POOL_SESSION, (void*)info->asset);
|
||||
dynos_model_load_geo(&id, MODEL_POOL_SESSION, (void*)info->asset, true);
|
||||
}
|
||||
return (u16)id;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue