mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-13 21:09:39 +00:00
Merge branch 'master' into tooltips
This commit is contained in:
commit
d1e298c2e1
2 changed files with 51 additions and 28 deletions
|
@ -45,8 +45,8 @@ NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, MWWorld::Environment& _env,O
|
||||||
zero = std::make_pair(blank, blankshape);
|
zero = std::make_pair(blank, blankshape);
|
||||||
chest = std::make_pair(blank, blankshape);
|
chest = std::make_pair(blank, blankshape);
|
||||||
tail = std::make_pair(blank, blankshape);
|
tail = std::make_pair(blank, blankshape);
|
||||||
lBeastFoot = std::make_pair(blank, blankshape);
|
lFreeFoot = std::make_pair(blank, blankshape);
|
||||||
rBeastFoot = std::make_pair(blank, blankshape);
|
rFreeFoot = std::make_pair(blank, blankshape);
|
||||||
rhand = std::make_pair(blank, blankshape);
|
rhand = std::make_pair(blank, blankshape);
|
||||||
lhand = std::make_pair(blank, blankshape);
|
lhand = std::make_pair(blank, blankshape);
|
||||||
skirt = std::make_pair(blank, blankshape);
|
skirt = std::make_pair(blank, blankshape);
|
||||||
|
@ -82,6 +82,7 @@ NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, MWWorld::Environment& _env,O
|
||||||
hairModel = "meshes\\" +
|
hairModel = "meshes\\" +
|
||||||
mEnvironment.mWorld->getStore().bodyParts.find(hairID)->model;
|
mEnvironment.mWorld->getStore().bodyParts.find(hairID)->model;
|
||||||
npcName = ref->base->name;
|
npcName = ref->base->name;
|
||||||
|
|
||||||
//ESMStore::Races r =
|
//ESMStore::Races r =
|
||||||
const ESM::Race* race = mEnvironment.mWorld->getStore().races.find(ref->base->race);
|
const ESM::Race* race = mEnvironment.mWorld->getStore().races.find(ref->base->race);
|
||||||
|
|
||||||
|
@ -242,6 +243,7 @@ void NpcAnimation::updateParts(){
|
||||||
}
|
}
|
||||||
|
|
||||||
if(apparelChanged){
|
if(apparelChanged){
|
||||||
|
|
||||||
if(robe != inv.end())
|
if(robe != inv.end())
|
||||||
{
|
{
|
||||||
MWWorld::Ptr ptr = *robe;
|
MWWorld::Ptr ptr = *robe;
|
||||||
|
@ -307,7 +309,6 @@ void NpcAnimation::updateParts(){
|
||||||
|
|
||||||
}
|
}
|
||||||
if(!isBeast && boots != inv.end()){
|
if(!isBeast && boots != inv.end()){
|
||||||
|
|
||||||
if(boots->getTypeName() == typeid(ESM::Clothing).name()){
|
if(boots->getTypeName() == typeid(ESM::Clothing).name()){
|
||||||
const ESM::Clothing *clothes = (boots->get<ESM::Clothing>())->base;
|
const ESM::Clothing *clothes = (boots->get<ESM::Clothing>())->base;
|
||||||
std::vector<ESM::PartReference> parts = clothes->parts.parts;
|
std::vector<ESM::PartReference> parts = clothes->parts.parts;
|
||||||
|
@ -322,7 +323,6 @@ void NpcAnimation::updateParts(){
|
||||||
|
|
||||||
}
|
}
|
||||||
if(leftglove != inv.end()){
|
if(leftglove != inv.end()){
|
||||||
|
|
||||||
if(leftglove->getTypeName() == typeid(ESM::Clothing).name()){
|
if(leftglove->getTypeName() == typeid(ESM::Clothing).name()){
|
||||||
const ESM::Clothing *clothes = (leftglove->get<ESM::Clothing>())->base;
|
const ESM::Clothing *clothes = (leftglove->get<ESM::Clothing>())->base;
|
||||||
std::vector<ESM::PartReference> parts = clothes->parts.parts;
|
std::vector<ESM::PartReference> parts = clothes->parts.parts;
|
||||||
|
@ -337,7 +337,6 @@ void NpcAnimation::updateParts(){
|
||||||
|
|
||||||
}
|
}
|
||||||
if(rightglove != inv.end()){
|
if(rightglove != inv.end()){
|
||||||
|
|
||||||
if(rightglove->getTypeName() == typeid(ESM::Clothing).name()){
|
if(rightglove->getTypeName() == typeid(ESM::Clothing).name()){
|
||||||
const ESM::Clothing *clothes = (rightglove->get<ESM::Clothing>())->base;
|
const ESM::Clothing *clothes = (rightglove->get<ESM::Clothing>())->base;
|
||||||
std::vector<ESM::PartReference> parts = clothes->parts.parts;
|
std::vector<ESM::PartReference> parts = clothes->parts.parts;
|
||||||
|
@ -502,6 +501,33 @@ Ogre::Entity* NpcAnimation::insertBoundedPart(const std::string &mesh, std::stri
|
||||||
|
|
||||||
base->attachObjectToBone(bonename, part);
|
base->attachObjectToBone(bonename, part);
|
||||||
return part;
|
return part;
|
||||||
|
}
|
||||||
|
void NpcAnimation::insertFootPart(int type, const std::string &mesh){
|
||||||
|
std::string meshAndSuffix = mesh;
|
||||||
|
if(type == ESM::PRT_LFoot)
|
||||||
|
meshAndSuffix += "*|";
|
||||||
|
NIFLoader::load(meshAndSuffix);
|
||||||
|
Ogre::Entity* part = mRend.getScene()->createEntity(meshAndSuffix);
|
||||||
|
std::vector<Nif::NiTriShapeCopy>* shape = ((NIFLoader::getSingletonPtr())->getShapes(meshAndSuffix));
|
||||||
|
if(shape == 0){
|
||||||
|
if(type == ESM::PRT_LFoot){
|
||||||
|
base->attachObjectToBone("Left Foot", part);
|
||||||
|
lfoot = part;
|
||||||
|
}
|
||||||
|
else if (type == ESM::PRT_RFoot){
|
||||||
|
base->attachObjectToBone("Right Foot", part);
|
||||||
|
rfoot = part;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
if(type == ESM::PRT_LFoot)
|
||||||
|
lFreeFoot = insertFreePart(mesh, "::");
|
||||||
|
else if (type == ESM::PRT_RFoot)
|
||||||
|
rFreeFoot = insertFreePart(mesh, ":<");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
std::pair<Ogre::Entity*, std::vector<Nif::NiTriShapeCopy>*> NpcAnimation::insertFreePart(const std::string &mesh, const std::string suffix){
|
std::pair<Ogre::Entity*, std::vector<Nif::NiTriShapeCopy>*> NpcAnimation::insertFreePart(const std::string &mesh, const std::string suffix){
|
||||||
|
|
||||||
|
@ -558,10 +584,11 @@ void NpcAnimation::runAnimation(float timepassed){
|
||||||
vecRotPos.clear();
|
vecRotPos.clear();
|
||||||
|
|
||||||
|
|
||||||
if(lBeastFoot.first)
|
if(lFreeFoot.first)
|
||||||
handleShapes(lBeastFoot.second, lBeastFoot.first, base->getSkeleton());
|
handleShapes(lFreeFoot.second, lFreeFoot.first, base->getSkeleton());
|
||||||
if(rBeastFoot.first)
|
if(rFreeFoot.first)
|
||||||
handleShapes(rBeastFoot.second, rBeastFoot.first, base->getSkeleton());
|
handleShapes(rFreeFoot.second, rFreeFoot.first, base->getSkeleton());
|
||||||
|
|
||||||
if(chest.first)
|
if(chest.first)
|
||||||
handleShapes(chest.second, chest.first, base->getSkeleton());
|
handleShapes(chest.second, chest.first, base->getSkeleton());
|
||||||
if(tail.first)
|
if(tail.first)
|
||||||
|
@ -645,9 +672,9 @@ void NpcAnimation::removeIndividualPart(int type){
|
||||||
base->detachObjectFromBone(rfoot);
|
base->detachObjectFromBone(rfoot);
|
||||||
rfoot = 0;
|
rfoot = 0;
|
||||||
}
|
}
|
||||||
else if(rBeastFoot.first){
|
else if(rFreeFoot.first){
|
||||||
insert->detachObject(rBeastFoot.first);
|
insert->detachObject(rFreeFoot.first);
|
||||||
rBeastFoot = zero;
|
rFreeFoot = zero;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(type == ESM::PRT_LFoot){ //16
|
else if(type == ESM::PRT_LFoot){ //16
|
||||||
|
@ -655,9 +682,9 @@ void NpcAnimation::removeIndividualPart(int type){
|
||||||
base->detachObjectFromBone(lfoot);
|
base->detachObjectFromBone(lfoot);
|
||||||
lfoot = 0;
|
lfoot = 0;
|
||||||
}
|
}
|
||||||
else if(lBeastFoot.first){
|
else if(lFreeFoot.first){
|
||||||
insert->detachObject(lBeastFoot.first);
|
insert->detachObject(lFreeFoot.first);
|
||||||
lBeastFoot = zero;
|
lFreeFoot = zero;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(type == ESM::PRT_RAnkle && rAnkle){ //17
|
else if(type == ESM::PRT_RAnkle && rAnkle){ //17
|
||||||
|
@ -771,18 +798,11 @@ void NpcAnimation::removeIndividualPart(int type){
|
||||||
lupperArm = insertBoundedPart(mesh + "*|", "Left Upper Arm");
|
lupperArm = insertBoundedPart(mesh + "*|", "Left Upper Arm");
|
||||||
break;
|
break;
|
||||||
case ESM::PRT_RFoot: //15
|
case ESM::PRT_RFoot: //15
|
||||||
if(isBeast)
|
insertFootPart(type, mesh);
|
||||||
rBeastFoot = insertFreePart(mesh, ":<");
|
|
||||||
else
|
|
||||||
rfoot = insertBoundedPart(mesh, "Right Foot");
|
|
||||||
break;
|
break;
|
||||||
case ESM::PRT_LFoot: //16
|
case ESM::PRT_LFoot: //16
|
||||||
if(isBeast)
|
insertFootPart(type, mesh);
|
||||||
lBeastFoot = insertFreePart(mesh, "::");
|
|
||||||
else
|
|
||||||
lfoot = insertBoundedPart(mesh + "*|", "Left Foot");
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ESM::PRT_RAnkle: //17
|
case ESM::PRT_RAnkle: //17
|
||||||
rAnkle = insertBoundedPart(mesh , "Right Ankle");
|
rAnkle = insertBoundedPart(mesh , "Right Ankle");
|
||||||
break;
|
break;
|
||||||
|
@ -826,13 +846,15 @@ void NpcAnimation::removeIndividualPart(int type){
|
||||||
ESM::PartReference part = parts[i];
|
ESM::PartReference part = parts[i];
|
||||||
|
|
||||||
const ESM::BodyPart *bodypart = 0;
|
const ESM::BodyPart *bodypart = 0;
|
||||||
|
|
||||||
if(isFemale)
|
if(isFemale)
|
||||||
bodypart = mEnvironment.mWorld->getStore().bodyParts.search (part.female);
|
bodypart = mEnvironment.mWorld->getStore().bodyParts.search (part.female);
|
||||||
if(!bodypart)
|
if(!bodypart)
|
||||||
bodypart = mEnvironment.mWorld->getStore().bodyParts.search (part.male);
|
bodypart = mEnvironment.mWorld->getStore().bodyParts.search (part.male);
|
||||||
if(bodypart)
|
if(bodypart){
|
||||||
addOrReplaceIndividualPart(part.part, group,priority,"meshes\\" + bodypart->model);
|
addOrReplaceIndividualPart(part.part, group,priority,"meshes\\" + bodypart->model);
|
||||||
else
|
}
|
||||||
|
else
|
||||||
reserveIndividualPart(part.part, group, priority);
|
reserveIndividualPart(part.part, group, priority);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,8 +29,8 @@ private:
|
||||||
std::pair<Ogre::Entity*, std::vector<Nif::NiTriShapeCopy>*> lhand;
|
std::pair<Ogre::Entity*, std::vector<Nif::NiTriShapeCopy>*> lhand;
|
||||||
std::pair<Ogre::Entity*, std::vector<Nif::NiTriShapeCopy>*> rhand;
|
std::pair<Ogre::Entity*, std::vector<Nif::NiTriShapeCopy>*> rhand;
|
||||||
std::pair<Ogre::Entity*, std::vector<Nif::NiTriShapeCopy>*> tail;
|
std::pair<Ogre::Entity*, std::vector<Nif::NiTriShapeCopy>*> tail;
|
||||||
std::pair<Ogre::Entity*, std::vector<Nif::NiTriShapeCopy>*> lBeastFoot;
|
std::pair<Ogre::Entity*, std::vector<Nif::NiTriShapeCopy>*> lFreeFoot;
|
||||||
std::pair<Ogre::Entity*, std::vector<Nif::NiTriShapeCopy>*> rBeastFoot;
|
std::pair<Ogre::Entity*, std::vector<Nif::NiTriShapeCopy>*> rFreeFoot;
|
||||||
|
|
||||||
int partslots[27]; //Each part slot is taken by clothing, armor, or is empty
|
int partslots[27]; //Each part slot is taken by clothing, armor, or is empty
|
||||||
int partpriorities[27];
|
int partpriorities[27];
|
||||||
|
@ -86,6 +86,7 @@ private:
|
||||||
virtual ~NpcAnimation();
|
virtual ~NpcAnimation();
|
||||||
Ogre::Entity* insertBoundedPart(const std::string &mesh, std::string bonename);
|
Ogre::Entity* insertBoundedPart(const std::string &mesh, std::string bonename);
|
||||||
std::pair<Ogre::Entity*, std::vector<Nif::NiTriShapeCopy>*> insertFreePart(const std::string &mesh, const std::string suffix);
|
std::pair<Ogre::Entity*, std::vector<Nif::NiTriShapeCopy>*> insertFreePart(const std::string &mesh, const std::string suffix);
|
||||||
|
void insertFootPart(int type, const std::string &mesh);
|
||||||
virtual void runAnimation(float timepassed);
|
virtual void runAnimation(float timepassed);
|
||||||
void updateParts();
|
void updateParts();
|
||||||
void removeIndividualPart(int type);
|
void removeIndividualPart(int type);
|
||||||
|
|
Loading…
Reference in a new issue