@@ -518,33 +518,39 @@ extern "C" int ResourceMgr_OTRSigCheck(char* imgData) {
518518}
519519
520520// Load animation with explicit alt asset path checking.
521- // This ensures animations are loaded with the correct alt/ prefix when alt assets are enabled,
522- // matching the behavior of skeleton loading and preventing cached vanilla animations from
523- // overriding alternate animations when toggling.
521+ // When Alt Assets is OFF: use original path directly (O2R or vanilla)
522+ // When Alt Assets is ON: try alt/ prefix first, fall back to regular path if not found
524523extern " C" AnimationHeaderCommon* ResourceMgr_LoadAnimByName (const char * path) {
525- std::string pathStr = std::string (path);
526- static const std::string sOtr = " __OTR__" ;
527-
528- // Strip the OTR signature prefix if present
529- if (pathStr.starts_with (sOtr )) {
530- pathStr = pathStr.substr (sOtr .length ());
531- }
532-
533524 bool isAlt = ResourceMgr_IsAltAssetsEnabled ();
534525
535- // Explicitly add alt prefix when alternate assets are enabled
536526 if (isAlt) {
537- pathStr = Ship::IResource::gAltAssetPrefix + pathStr;
538- }
527+ std::string pathStr = std::string (path);
528+ static const std::string sOtr = " __OTR__" ;
529+
530+ if (pathStr.starts_with (sOtr )) {
531+ pathStr = pathStr.substr (sOtr .length ());
532+ }
539533
540- AnimationHeaderCommon* animHeader = (AnimationHeaderCommon*)ResourceGetDataByName (pathStr.c_str ());
534+ // Try alt/ first
535+ pathStr = Ship::IResource::gAltAssetPrefix + pathStr;
536+ AnimationHeaderCommon* animHeader = (AnimationHeaderCommon*)ResourceGetDataByName (pathStr.c_str ());
537+
538+ // If alt loaded successfully and has valid frame data, return it
539+ if (animHeader != NULL ) {
540+ // Check if it's a Link animation and has valid segment data
541+ LinkAnimationHeader* linkAnim = (LinkAnimationHeader*)animHeader;
542+ if (linkAnim->segment != NULL ) {
543+ return animHeader;
544+ }
545+ // Alt loaded but segment is null (broken), fall through to original path
546+ }
541547
542- // If there isn't an alternate animation, fall back to the regular one
543- if (isAlt && animHeader == NULL ) {
544- animHeader = (AnimationHeaderCommon*)ResourceGetDataByName (path);
548+ // Fall back to original path
549+ return (AnimationHeaderCommon*)ResourceGetDataByName (path);
545550 }
546551
547- return animHeader;
552+ // Alt OFF: use original path directly
553+ return (AnimationHeaderCommon*)ResourceGetDataByName (path);
548554}
549555
550556extern " C" SkeletonHeader* ResourceMgr_LoadSkeletonByName (const char * path, SkelAnime* skelAnime) {
0 commit comments