Added skin offsets code

Added code to apply skin offsets if present on skin. Armor offsets defined in skin will also be applied.
This commit is contained in:
Langtanium
2026-06-22 15:14:52 -07:00
committed by Langtanium
parent 9c6781013f
commit 7ba554c7ec
18 changed files with 852 additions and 68 deletions
@@ -59,6 +59,7 @@ UIScene_SkinSelectMenu::UIScene_SkinSelectMenu(int iPad, void *initData, UILayer
m_selectedSkinPath = L"";
m_selectedCapePath = L"";
m_vAdditionalSkinBoxes = nullptr;
m_vSkinOffsets = nullptr;
m_bSlidingSkins = false;
m_bAnimatingMove = false;
@@ -662,6 +663,7 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged()
m_selectedSkinPath = skinFile->getPath();
m_selectedCapePath = skinFile->getParameterAsString(DLCManager::e_DLCParamType_Cape);
m_vAdditionalSkinBoxes = skinFile->getAdditionalBoxes();
m_vSkinOffsets = skinFile->getOffsets();
skinName = skinFile->getParameterAsString( DLCManager::e_DLCParamType_DisplayName );
skinOrigin = skinFile->getParameterAsString( DLCManager::e_DLCParamType_ThemeName );
@@ -684,6 +686,7 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged()
m_selectedSkinPath = L"";
m_selectedCapePath = L"";
m_vAdditionalSkinBoxes = nullptr;
m_vSkinOffsets = nullptr;
switch(m_packIndex)
{
@@ -726,6 +729,7 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged()
m_selectedSkinPath = skinFile->getPath();
m_selectedCapePath = skinFile->getParameterAsString(DLCManager::e_DLCParamType_Cape);
m_vAdditionalSkinBoxes = skinFile->getAdditionalBoxes();
m_vSkinOffsets = skinFile->getOffsets();
skinName = skinFile->getParameterAsString( DLCManager::e_DLCParamType_DisplayName );
skinOrigin = skinFile->getParameterAsString( DLCManager::e_DLCParamType_ThemeName );
@@ -773,6 +777,17 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged()
pAdditionalModelParts = app.SetAdditionalSkinBoxes(skinFile->getSkinID(),m_vAdditionalSkinBoxes);
}
}
if(m_vSkinOffsets && m_vSkinOffsets->size()!=0)
{
// add the skin Offsets to the humanoid model, but only if we've not done this already
vector<SKIN_OFFSET *> *pSkinOffsets = app.GetSkinOffsets(skinFile->getSkinID());
if(pSkinOffsets==nullptr)
{
pSkinOffsets = app.SetSkinOffsets(skinFile->getSkinID(),m_vSkinOffsets);
}
}
if(skinFile!=nullptr)
{
@@ -790,6 +805,7 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged()
wstring otherSkinPath = L"";
wstring otherCapePath = L"";
vector<SKIN_BOX *> *othervAdditionalSkinBoxes=nullptr;
vector<SKIN_OFFSET *> *othervSkinOffsets=nullptr;
wchar_t chars[256];
// turn off all displays
@@ -844,6 +860,7 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged()
otherSkinPath = skinFile->getPath();
otherCapePath = skinFile->getParameterAsString(DLCManager::e_DLCParamType_Cape);
othervAdditionalSkinBoxes = skinFile->getAdditionalBoxes();
othervSkinOffsets = skinFile->getOffsets();
backupTexture = TN_MOB_CHAR;
}
else
@@ -851,6 +868,7 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged()
otherSkinPath = L"";
otherCapePath = L"";
othervAdditionalSkinBoxes=nullptr;
othervSkinOffsets=nullptr;
switch(m_packIndex)
{
case SKIN_SELECT_PACK_DEFAULT:
@@ -870,6 +888,7 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged()
otherSkinPath = skinFile->getPath();
otherCapePath = skinFile->getParameterAsString(DLCManager::e_DLCParamType_Cape);
othervAdditionalSkinBoxes = skinFile->getAdditionalBoxes();
othervSkinOffsets = skinFile->getOffsets();
backupTexture = TN_MOB_CHAR;
}
}
@@ -887,6 +906,14 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged()
pAdditionalModelParts = app.SetAdditionalSkinBoxes(skinFile->getSkinID(),othervAdditionalSkinBoxes);
}
}
if(othervSkinOffsets && othervSkinOffsets->size()!=0)
{
vector<SKIN_OFFSET *> *pSkinOffsets = app.GetSkinOffsets(skinFile->getSkinID());
if(pSkinOffsets==nullptr)
{
pSkinOffsets = app.SetSkinOffsets(skinFile->getSkinID(),othervSkinOffsets);
}
}
// 4J-PB - anim override needs set before SetTexture
if(skinFile!=nullptr)
{
@@ -915,6 +942,7 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged()
otherSkinPath = skinFile->getPath();
otherCapePath = skinFile->getParameterAsString(DLCManager::e_DLCParamType_Cape);
othervAdditionalSkinBoxes = skinFile->getAdditionalBoxes();
othervSkinOffsets = skinFile->getOffsets();
backupTexture = TN_MOB_CHAR;
}
else
@@ -922,6 +950,7 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged()
otherSkinPath = L"";
otherCapePath = L"";
othervAdditionalSkinBoxes=nullptr;
othervSkinOffsets=nullptr;
switch(m_packIndex)
{
case SKIN_SELECT_PACK_DEFAULT:
@@ -941,6 +970,7 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged()
otherSkinPath = skinFile->getPath();
otherCapePath = skinFile->getParameterAsString(DLCManager::e_DLCParamType_Cape);
othervAdditionalSkinBoxes = skinFile->getAdditionalBoxes();
othervSkinOffsets = skinFile->getOffsets();
backupTexture = TN_MOB_CHAR;
}
}
@@ -958,6 +988,14 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged()
pAdditionalModelParts = app.SetAdditionalSkinBoxes(skinFile->getSkinID(),othervAdditionalSkinBoxes);
}
}
if(othervSkinOffsets && othervSkinOffsets->size()!=0)
{
vector<SKIN_OFFSET *> *pSkinOffsets = app.GetSkinOffsets(skinFile->getSkinID());
if(pSkinOffsets==nullptr)
{
pSkinOffsets = app.SetSkinOffsets(skinFile->getSkinID(),othervSkinOffsets);
}
}
// 4J-PB - anim override needs set before SetTexture
if(skinFile)
{