mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-25 19:02:19 -05:00
Tweak skeleton limbs to use OTR path strings for loading DList and improve Alt toggling (#3479)
* set otr string paths for DList on skeleton limbs * delay toggling alt assets cvar to end of frame
This commit is contained in:
parent
818addfdda
commit
fbc397a131
@ -1145,7 +1145,7 @@ extern "C" void Graph_ProcessFrame(void (*run_one_game_iter)(void)) {
|
||||
OTRGlobals::Instance->context->GetWindow()->MainLoop(run_one_game_iter);
|
||||
}
|
||||
|
||||
extern bool ShouldClearTextureCacheAtEndOfFrame;
|
||||
extern bool ToggleAltAssetsAtEndOfFrame;
|
||||
|
||||
extern "C" void Graph_StartFrame() {
|
||||
#ifndef __WIIU__
|
||||
@ -1228,10 +1228,7 @@ extern "C" void Graph_StartFrame() {
|
||||
}
|
||||
#endif
|
||||
case KbScancode::LUS_KB_TAB: {
|
||||
// Toggle HD Assets
|
||||
CVarSetInteger("gAltAssets", !CVarGetInteger("gAltAssets", 0));
|
||||
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnAssetAltChange>();
|
||||
ShouldClearTextureCacheAtEndOfFrame = true;
|
||||
ToggleAltAssetsAtEndOfFrame = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1301,10 +1298,14 @@ extern "C" void Graph_ProcessGfxCommands(Gfx* commands) {
|
||||
}
|
||||
}
|
||||
|
||||
if (ShouldClearTextureCacheAtEndOfFrame) {
|
||||
if (ToggleAltAssetsAtEndOfFrame) {
|
||||
ToggleAltAssetsAtEndOfFrame = false;
|
||||
|
||||
// Actually update the CVar now before runing the alt asset update listeners
|
||||
CVarSetInteger("gAltAssets", !CVarGetInteger("gAltAssets", 0));
|
||||
gfx_texture_cache_clear();
|
||||
LUS::SkeletonPatcher::UpdateSkeletons();
|
||||
ShouldClearTextureCacheAtEndOfFrame = false;
|
||||
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnAssetAltChange>();
|
||||
}
|
||||
|
||||
// OTRTODO: FIGURE OUT END FRAME POINT
|
||||
|
@ -38,7 +38,7 @@
|
||||
#include "Enhancements/game-interactor/GameInteractor.h"
|
||||
#include "Enhancements/cosmetics/authenticGfxPatches.h"
|
||||
|
||||
bool ShouldClearTextureCacheAtEndOfFrame = false;
|
||||
bool ToggleAltAssetsAtEndOfFrame = false;
|
||||
bool isBetaQuestEnabled = false;
|
||||
|
||||
extern "C" {
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "Enhancements/randomizer/randomizer_item_tracker.h"
|
||||
#include "Enhancements/randomizer/randomizer_settings_window.h"
|
||||
|
||||
extern bool ShouldClearTextureCacheAtEndOfFrame;
|
||||
extern bool ToggleAltAssetsAtEndOfFrame;
|
||||
extern bool isBetaQuestEnabled;
|
||||
|
||||
extern "C" PlayState* gPlayState;
|
||||
@ -908,8 +908,10 @@ void DrawEnhancementsMenu() {
|
||||
{
|
||||
if (ImGui::BeginMenu("Mods")) {
|
||||
if (UIWidgets::PaddedEnhancementCheckbox("Use Alternate Assets", "gAltAssets", false, false)) {
|
||||
ShouldClearTextureCacheAtEndOfFrame = true;
|
||||
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnAssetAltChange>();
|
||||
// The checkbox will flip the alt asset CVar, but we instead want it to change at the end of the game frame
|
||||
// We toggle it back while setting the flag to update the CVar later
|
||||
CVarSetInteger("gAltAssets", !CVarGetInteger("gAltAssets", 0));
|
||||
ToggleAltAssetsAtEndOfFrame = true;
|
||||
}
|
||||
UIWidgets::Tooltip("Toggle between standard assets and alternate assets. Usually mods will indicate if this setting has to be used or not.");
|
||||
UIWidgets::PaddedEnhancementCheckbox("Disable Bomb Billboarding", "gDisableBombBillboarding", true, false);
|
||||
|
@ -132,15 +132,15 @@ void LUS::SkeletonLimbFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> r
|
||||
skeletonLimb->limbData.lodLimb.sibling = skeletonLimb->siblingIndex;
|
||||
|
||||
if (skeletonLimb->dListPtr != "") {
|
||||
auto dList = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(skeletonLimb->dListPtr.c_str());
|
||||
skeletonLimb->limbData.lodLimb.dLists[0] = (Gfx*)(dList ? dList->GetRawPointer() : nullptr);
|
||||
skeletonLimb->dListPtr = "__OTR__" + skeletonLimb->dListPtr;
|
||||
skeletonLimb->limbData.lodLimb.dLists[0] = (Gfx*)skeletonLimb->dListPtr.c_str();
|
||||
} else {
|
||||
skeletonLimb->limbData.lodLimb.dLists[0] = nullptr;
|
||||
}
|
||||
|
||||
if (skeletonLimb->dList2Ptr != "") {
|
||||
auto dList = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(skeletonLimb->dList2Ptr.c_str());
|
||||
skeletonLimb->limbData.lodLimb.dLists[1] = (Gfx*)(dList ? dList->GetRawPointer() : nullptr);
|
||||
skeletonLimb->dList2Ptr = "__OTR__" + skeletonLimb->dList2Ptr;
|
||||
skeletonLimb->limbData.lodLimb.dLists[1] = (Gfx*)skeletonLimb->dList2Ptr.c_str();
|
||||
} else {
|
||||
skeletonLimb->limbData.lodLimb.dLists[1] = nullptr;
|
||||
}
|
||||
@ -153,8 +153,8 @@ void LUS::SkeletonLimbFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> r
|
||||
skeletonLimb->limbData.standardLimb.dList = nullptr;
|
||||
|
||||
if (!skeletonLimb->dListPtr.empty()) {
|
||||
const auto dList = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(skeletonLimb->dListPtr.c_str());
|
||||
skeletonLimb->limbData.standardLimb.dList = (Gfx*)(dList ? dList->GetRawPointer() : nullptr);
|
||||
skeletonLimb->dListPtr = "__OTR__" + skeletonLimb->dListPtr;
|
||||
skeletonLimb->limbData.standardLimb.dList = (Gfx*)skeletonLimb->dListPtr.c_str();
|
||||
}
|
||||
} else if (skeletonLimb->limbType == LUS::LimbType::Curve) {
|
||||
skeletonLimb->limbData.skelCurveLimb.firstChildIdx = skeletonLimb->childIndex;
|
||||
@ -163,13 +163,13 @@ void LUS::SkeletonLimbFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> r
|
||||
skeletonLimb->limbData.skelCurveLimb.dList[1] = nullptr;
|
||||
|
||||
if (!skeletonLimb->dListPtr.empty()) {
|
||||
const auto dList = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(skeletonLimb->dListPtr.c_str());
|
||||
skeletonLimb->limbData.skelCurveLimb.dList[0] = (Gfx*)(dList ? dList->GetRawPointer() : nullptr);
|
||||
skeletonLimb->dListPtr = "__OTR__" + skeletonLimb->dListPtr;
|
||||
skeletonLimb->limbData.skelCurveLimb.dList[0] = (Gfx*)skeletonLimb->dListPtr.c_str();
|
||||
}
|
||||
|
||||
if (!skeletonLimb->dList2Ptr.empty()) {
|
||||
const auto dList = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(skeletonLimb->dList2Ptr.c_str());
|
||||
skeletonLimb->limbData.skelCurveLimb.dList[1] = (Gfx*)(dList ? dList->GetRawPointer() : nullptr);
|
||||
skeletonLimb->dList2Ptr = "__OTR__" + skeletonLimb->dList2Ptr;
|
||||
skeletonLimb->limbData.skelCurveLimb.dList[1] = (Gfx*)skeletonLimb->dList2Ptr.c_str();
|
||||
}
|
||||
} else if (skeletonLimb->limbType == LUS::LimbType::Skin) {
|
||||
skeletonLimb->limbData.skinLimb.jointPos.x = skeletonLimb->transX;
|
||||
@ -189,14 +189,23 @@ void LUS::SkeletonLimbFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> r
|
||||
}
|
||||
|
||||
if (skeletonLimb->skinSegmentType == LUS::ZLimbSkinType::SkinType_DList) {
|
||||
auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(skeletonLimb->skinDList.c_str());
|
||||
skeletonLimb->limbData.skinLimb.segment = res ? res->GetRawPointer() : nullptr;
|
||||
if (skeletonLimb->skinDList != "") {
|
||||
skeletonLimb->skinDList = "__OTR__" + skeletonLimb->skinDList;
|
||||
skeletonLimb->limbData.skinLimb.segment = (Gfx*)skeletonLimb->skinDList.c_str();
|
||||
} else {
|
||||
skeletonLimb->limbData.skinLimb.segment = nullptr;
|
||||
}
|
||||
} else if (skeletonLimb->skinSegmentType == LUS::ZLimbSkinType::SkinType_4) {
|
||||
skeletonLimb->skinAnimLimbData.totalVtxCount = skeletonLimb->skinVtxCnt;
|
||||
skeletonLimb->skinAnimLimbData.limbModifCount = skeletonLimb->skinLimbModifCount;
|
||||
skeletonLimb->skinAnimLimbData.limbModifications = skeletonLimb->skinLimbModifArray.data();
|
||||
auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(skeletonLimb->skinDList2.c_str());
|
||||
skeletonLimb->skinAnimLimbData.dlist = (Gfx*)(res ? res->GetRawPointer() : nullptr);
|
||||
|
||||
if (skeletonLimb->skinDList2 != "") {
|
||||
skeletonLimb->skinDList2 = "__OTR__" + skeletonLimb->skinDList2;
|
||||
skeletonLimb->skinAnimLimbData.dlist = (Gfx*)skeletonLimb->skinDList2.c_str();
|
||||
} else {
|
||||
skeletonLimb->skinAnimLimbData.dlist = nullptr;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < skeletonLimb->skinLimbModifArray.size(); i++) {
|
||||
skeletonLimb->skinAnimLimbData.limbModifications[i].vtxCount = skeletonLimb->skinLimbModifVertexArrays[i].size();
|
||||
@ -254,8 +263,8 @@ void SkeletonLimbFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shar
|
||||
limbData.lodLimb.jointPos.z = skelLimb->transZ;
|
||||
|
||||
if (skelLimb->dListPtr != "") {
|
||||
auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess((const char*)skelLimb->dListPtr.c_str());
|
||||
limbData.lodLimb.dLists[0] = (Gfx*)(res ? res->GetRawPointer() : nullptr);
|
||||
skelLimb->dListPtr = "__OTR__" + skelLimb->dListPtr;
|
||||
limbData.lodLimb.dLists[0] = (Gfx*)skelLimb->dListPtr.c_str();
|
||||
} else {
|
||||
limbData.lodLimb.dLists[0] = nullptr;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user