mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 22:53:50 +00:00
Shirts and Cuirasses
This commit is contained in:
parent
7551926afd
commit
5d4ad4cd81
3 changed files with 60 additions and 12 deletions
|
@ -89,7 +89,7 @@ namespace MWClass
|
||||||
|
|
||||||
static const int sMapping[size][2] =
|
static const int sMapping[size][2] =
|
||||||
{
|
{
|
||||||
{ ESM::Clothing::Shirt, MWWorld::InventoryStore::Slot_Cuirass },
|
{ ESM::Clothing::Shirt, MWWorld::InventoryStore::Slot_Shirt },
|
||||||
{ ESM::Clothing::Belt, MWWorld::InventoryStore::Slot_Belt },
|
{ ESM::Clothing::Belt, MWWorld::InventoryStore::Slot_Belt },
|
||||||
{ ESM::Clothing::Robe, MWWorld::InventoryStore::Slot_Robe },
|
{ ESM::Clothing::Robe, MWWorld::InventoryStore::Slot_Robe },
|
||||||
{ ESM::Clothing::Pants, MWWorld::InventoryStore::Slot_Pants },
|
{ ESM::Clothing::Pants, MWWorld::InventoryStore::Slot_Pants },
|
||||||
|
|
|
@ -13,7 +13,8 @@ NpcAnimation::~NpcAnimation(){
|
||||||
|
|
||||||
|
|
||||||
NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, MWWorld::Environment& _env,OEngine::Render::OgreRenderer& _rend, MWWorld::InventoryStore& _inv): Animation(_env,_rend), mStateID(-1), inv(_inv), timeToChange(0),
|
NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, MWWorld::Environment& _env,OEngine::Render::OgreRenderer& _rend, MWWorld::InventoryStore& _inv): Animation(_env,_rend), mStateID(-1), inv(_inv), timeToChange(0),
|
||||||
robe(inv.getSlot(MWWorld::InventoryStore::Slot_Robe)), helmet(inv.getSlot(MWWorld::InventoryStore::Slot_Helmet)),
|
robe(inv.getSlot(MWWorld::InventoryStore::Slot_Robe)), helmet(inv.getSlot(MWWorld::InventoryStore::Slot_Helmet)), shirt(inv.getSlot(MWWorld::InventoryStore::Slot_Shirt)),
|
||||||
|
cuirass(inv.getSlot(MWWorld::InventoryStore::Slot_Cuirass)),
|
||||||
lclavicle(0),
|
lclavicle(0),
|
||||||
rclavicle(0),
|
rclavicle(0),
|
||||||
rupperArm(0),
|
rupperArm(0),
|
||||||
|
@ -159,7 +160,7 @@ void NpcAnimation::updateParts(){
|
||||||
|
|
||||||
std::string hairModel = "meshes\\" +
|
std::string hairModel = "meshes\\" +
|
||||||
mEnvironment.mWorld->getStore().bodyParts.find(hairID)->model;
|
mEnvironment.mWorld->getStore().bodyParts.find(hairID)->model;
|
||||||
|
bool apparelChanged = false;
|
||||||
|
|
||||||
|
|
||||||
//inv.getSlot(MWWorld::InventoryStore::Slot_Robe);
|
//inv.getSlot(MWWorld::InventoryStore::Slot_Robe);
|
||||||
|
@ -167,6 +168,30 @@ void NpcAnimation::updateParts(){
|
||||||
//A robe was added or removed
|
//A robe was added or removed
|
||||||
removePartGroup(MWWorld::InventoryStore::Slot_Robe);
|
removePartGroup(MWWorld::InventoryStore::Slot_Robe);
|
||||||
robe = inv.getSlot(MWWorld::InventoryStore::Slot_Robe);
|
robe = inv.getSlot(MWWorld::InventoryStore::Slot_Robe);
|
||||||
|
apparelChanged = true;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
if(helmet != inv.getSlot(MWWorld::InventoryStore::Slot_Helmet)){
|
||||||
|
apparelChanged = true;
|
||||||
|
helmet = inv.getSlot(MWWorld::InventoryStore::Slot_Helmet);
|
||||||
|
removePartGroup(MWWorld::InventoryStore::Slot_Helmet);
|
||||||
|
|
||||||
|
}
|
||||||
|
if(cuirass != inv.getSlot(MWWorld::InventoryStore::Slot_Cuirass)){
|
||||||
|
cuirass = inv.getSlot(MWWorld::InventoryStore::Slot_Cuirass);
|
||||||
|
removePartGroup(MWWorld::InventoryStore::Slot_Cuirass);
|
||||||
|
apparelChanged = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
if(shirt != inv.getSlot(MWWorld::InventoryStore::Slot_Shirt)){
|
||||||
|
shirt = inv.getSlot(MWWorld::InventoryStore::Slot_Shirt);
|
||||||
|
removePartGroup(MWWorld::InventoryStore::Slot_Shirt);
|
||||||
|
apparelChanged = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(apparelChanged){
|
||||||
if(robe != inv.end())
|
if(robe != inv.end())
|
||||||
{
|
{
|
||||||
MWWorld::Ptr ptr = *robe;
|
MWWorld::Ptr ptr = *robe;
|
||||||
|
@ -184,12 +209,8 @@ void NpcAnimation::updateParts(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
if(helmet != inv.getSlot(MWWorld::InventoryStore::Slot_Helmet)){
|
|
||||||
helmet = inv.getSlot(MWWorld::InventoryStore::Slot_Helmet);
|
|
||||||
removePartGroup(MWWorld::InventoryStore::Slot_Helmet);
|
|
||||||
removeIndividualPart(ESM::PRT_Hair);
|
|
||||||
if(helmet != inv.end()){
|
if(helmet != inv.end()){
|
||||||
|
removeIndividualPart(ESM::PRT_Hair);
|
||||||
const ESM::Armor *armor = (helmet->get<ESM::Armor>())->base;
|
const ESM::Armor *armor = (helmet->get<ESM::Armor>())->base;
|
||||||
std::vector<ESM::PartReference> parts = armor->parts.parts;
|
std::vector<ESM::PartReference> parts = armor->parts.parts;
|
||||||
for(int i = 0; i < parts.size(); i++)
|
for(int i = 0; i < parts.size(); i++)
|
||||||
|
@ -202,7 +223,32 @@ void NpcAnimation::updateParts(){
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(cuirass != inv.end()){
|
||||||
|
const ESM::Armor *armor = (cuirass->get<ESM::Armor>())->base;
|
||||||
|
std::vector<ESM::PartReference> parts = armor->parts.parts;
|
||||||
|
for(int i = 0; i < parts.size(); i++)
|
||||||
|
{
|
||||||
|
ESM::PartReference part = parts[i];
|
||||||
|
|
||||||
|
const ESM::BodyPart *bodypart = mEnvironment.mWorld->getStore().bodyParts.search (part.male);
|
||||||
|
if(bodypart)
|
||||||
|
addOrReplaceIndividualPart(part.part, MWWorld::InventoryStore::Slot_Cuirass,3,"meshes\\" + bodypart->model);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(shirt != inv.end()){
|
||||||
|
const ESM::Clothing *clothes = (shirt->get<ESM::Clothing>())->base;
|
||||||
|
std::vector<ESM::PartReference> parts = clothes->parts.parts;
|
||||||
|
for(int i = 0; i < parts.size(); i++)
|
||||||
|
{
|
||||||
|
ESM::PartReference part = parts[i];
|
||||||
|
|
||||||
|
const ESM::BodyPart *bodypart = mEnvironment.mWorld->getStore().bodyParts.search (part.male);
|
||||||
|
if(bodypart)
|
||||||
|
addOrReplaceIndividualPart(part.part, MWWorld::InventoryStore::Slot_Shirt,2,"meshes\\" + bodypart->model);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(partpriorities[ESM::PRT_Cuirass] < 1){
|
if(partpriorities[ESM::PRT_Cuirass] < 1){
|
||||||
|
|
|
@ -69,6 +69,8 @@ private:
|
||||||
float timeToChange;
|
float timeToChange;
|
||||||
MWWorld::ContainerStoreIterator robe;
|
MWWorld::ContainerStoreIterator robe;
|
||||||
MWWorld::ContainerStoreIterator helmet;
|
MWWorld::ContainerStoreIterator helmet;
|
||||||
|
MWWorld::ContainerStoreIterator shirt;
|
||||||
|
MWWorld::ContainerStoreIterator cuirass;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NpcAnimation(const MWWorld::Ptr& ptr, MWWorld::Environment& _env, OEngine::Render::OgreRenderer& _rend, MWWorld::InventoryStore& _inv);
|
NpcAnimation(const MWWorld::Ptr& ptr, MWWorld::Environment& _env, OEngine::Render::OgreRenderer& _rend, MWWorld::InventoryStore& _inv);
|
||||||
|
|
Loading…
Reference in a new issue