From f51b33cc3b2974ed11988d3ea1f676b2f23ddefb Mon Sep 17 00:00:00 2001 From: kervala Date: Sun, 20 Dec 2015 11:09:41 +0100 Subject: [PATCH] Fixed: Use correct shape for boots when caster dress is equipped --HG-- branch : develop --- .../client/src/interface_v3/character_3d.cpp | 44 +++++++++++++ code/ryzom/client/src/player_cl.cpp | 63 +++++++++++++++++-- 2 files changed, 101 insertions(+), 6 deletions(-) diff --git a/code/ryzom/client/src/interface_v3/character_3d.cpp b/code/ryzom/client/src/interface_v3/character_3d.cpp index 291ab763d..0773a1a77 100644 --- a/code/ryzom/client/src/interface_v3/character_3d.cpp +++ b/code/ryzom/client/src/interface_v3/character_3d.cpp @@ -440,6 +440,50 @@ void SCharacter3DSetup::setupFromCS_ModelCol (SLOTTYPE::EVisualSlot s, sint32 mo else Parts[part].Name = item->getShapeFemale(); + // use the right type of boots if wearing a caster dress + if ((s == SLOTTYPE::FEET_SLOT) && (item->ItemType == ITEM_TYPE::LIGHT_BOOTS)) + { + std::string shapeLegs = Parts[Char3DPart_Legs].Name; + + if (shapeLegs.find("_caster01_") != std::string::npos) + { + std::string tmpName = toLower(Parts[part].Name); + + std::string::size_type posBottes = tmpName.find("_bottes"); + + if (posBottes != std::string::npos) + { + std::string orgType = tmpName.substr(7, posBottes-7); // underwear, caster01, armor00 or armor01 + + tmpName.replace(posBottes+7, 0, "_" + orgType); + tmpName.replace(7, orgType.length(), "caster01"); + + // temporary hack because Fyros boots don't respect conventions + if (tmpName[0] == 'f') + { + if (tmpName[5] == 'f') + { + tmpName = "fy_hof_caster01_bottes_civil.shape"; + } + else + { + tmpName = "fy_hom_caster01_civil01_bottes.shape"; + } + } + + // use fixed shape name only if file is present + if (CPath::exists(tmpName)) + { + Parts[part].Name = tmpName; + } + else + { + nlwarning("File %s doesn't exist, use %s", tmpName.c_str(), Parts[part].Name.c_str()); + } + } + } + } + // FX { Parts[part].AdvFx = item->FX.getAdvantageFX(); diff --git a/code/ryzom/client/src/player_cl.cpp b/code/ryzom/client/src/player_cl.cpp index a050ac197..1052f0742 100644 --- a/code/ryzom/client/src/player_cl.cpp +++ b/code/ryzom/client/src/player_cl.cpp @@ -542,12 +542,63 @@ void CPlayerCL::equip(SLOTTYPE::EVisualSlot slot, uint index, uint color) { const CItemSheet *item = _Items[slot].Sheet; - // If the gender is a female get the right shape. - if(_Gender == GSGENDER::female) - equip(slot, item->getShapeFemale(), item); - // Else get the default shape. - else - equip(slot, item->getShape(), item); + std::string shapeName = _Gender == GSGENDER::female ? item->getShapeFemale():item->getShape(); + + // use the right type of boots if wearing a caster dress + if ((slot == SLOTTYPE::FEET_SLOT) && (item->ItemType == ITEM_TYPE::LIGHT_BOOTS)) + { + std::string shapeLegs; + + if (!_Instances[SLOTTYPE::LEGS_SLOT].Loading.empty()) + { + shapeLegs = _Instances[SLOTTYPE::LEGS_SLOT].LoadingName; + } + else if (!_Instances[SLOTTYPE::LEGS_SLOT].Current.empty()) + { + shapeLegs = _Instances[SLOTTYPE::LEGS_SLOT].CurrentName; + } + + if (!shapeLegs.empty() && shapeLegs.find("_caster01_") != std::string::npos) + { + std::string tmpName = toLower(shapeName); + + std::string::size_type posBottes = tmpName.find("_bottes"); + + if (posBottes != std::string::npos) + { + std::string orgType = tmpName.substr(7, posBottes-7); // underwear, caster01, armor00 or armor01 + + tmpName.replace(posBottes+7, 0, "_" + orgType); + tmpName.replace(7, orgType.length(), "caster01"); + + // temporary hack because Fyros boots don't respect conventions + if (tmpName[0] == 'f') + { + if (tmpName[5] == 'f') + { + tmpName = "fy_hof_caster01_bottes_civil.shape"; + } + else + { + tmpName = "fy_hom_caster01_civil01_bottes.shape"; + } + } + + // use fixed shape name only if file is present + if (CPath::exists(tmpName)) + { + shapeName = tmpName; + } + else + { + nlwarning("File %s doesn't exist, use %s", tmpName.c_str(), shapeName.c_str()); + } + } + } + } + + // If the gender is a female get the right shape else get the default shape. + equip(slot, shapeName, item); // Check there is a shape. UInstance pInst = _Instances[slot].createLoadingFromCurrent();