mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-22 17:32:19 -05:00
fix: properly load custom models on scene transition (#2779)
* hack that makes it so custom models still work on scene transition * Update soh/soh/OTRGlobals.cpp Co-authored-by: Nicholas Estelami <NEstelami@users.noreply.github.com> * naming/formatting --------- Co-authored-by: briaguya <briaguya@alice> Co-authored-by: Nicholas Estelami <NEstelami@users.noreply.github.com>
This commit is contained in:
parent
f81b042843
commit
7d0515c501
@ -1,4 +1,4 @@
|
|||||||
#include "OTRGlobals.h"
|
#include "OTRGlobals.h"
|
||||||
#include "OTRAudio.h"
|
#include "OTRAudio.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@ -1392,9 +1392,26 @@ extern "C" AnimationHeaderCommon* ResourceMgr_LoadAnimByName(const char* path) {
|
|||||||
return (AnimationHeaderCommon*)GetResourceDataByName(path, false);
|
return (AnimationHeaderCommon*)GetResourceDataByName(path, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" SkeletonHeader* ResourceMgr_LoadSkeletonByName(const char* path, SkelAnime* skelAnime)
|
extern "C" SkeletonHeader* ResourceMgr_LoadSkeletonByName(const char* path, SkelAnime* skelAnime) {
|
||||||
{
|
std::string pathStr = std::string(path);
|
||||||
SkeletonHeader* skelHeader = (SkeletonHeader*)GetResourceDataByName(path, false);
|
static const std::string sOtr = "__OTR__";
|
||||||
|
|
||||||
|
if (pathStr.starts_with(sOtr)) {
|
||||||
|
pathStr = pathStr.substr(sOtr.length());
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isAlt = CVarGetInteger("gAltAssets", 0);
|
||||||
|
|
||||||
|
if (isAlt) {
|
||||||
|
pathStr = Ship::Resource::gAltAssetPrefix + pathStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
SkeletonHeader* skelHeader = (SkeletonHeader*)GetResourceDataByName(pathStr.c_str(), false);
|
||||||
|
|
||||||
|
// If there isn't an alternate model, load the regular one
|
||||||
|
if (isAlt && skelHeader == NULL) {
|
||||||
|
skelHeader = (SkeletonHeader*)GetResourceDataByName(path, false);
|
||||||
|
}
|
||||||
|
|
||||||
// This function is only called when a skeleton is initialized.
|
// This function is only called when a skeleton is initialized.
|
||||||
// Therefore we can take this oppurtunity to take note of the Skeleton that is created...
|
// Therefore we can take this oppurtunity to take note of the Skeleton that is created...
|
||||||
@ -1403,7 +1420,6 @@ extern "C" SkeletonHeader* ResourceMgr_LoadSkeletonByName(const char* path, Skel
|
|||||||
Ship::SkeletonPatcher::RegisterSkeleton(stringPath, skelAnime);
|
Ship::SkeletonPatcher::RegisterSkeleton(stringPath, skelAnime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return skelHeader;
|
return skelHeader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user