mirror of
https://github.com/OpenMW/openmw.git
synced 2026-01-04 20:13:08 +00:00
Cleanup(actoradapter): Use more explicit names & vec2 for racial height/weight
This commit is contained in:
parent
049550d73e
commit
98ad059806
3 changed files with 22 additions and 22 deletions
|
|
@ -67,9 +67,9 @@ namespace CSMWorld
|
|||
return mMaleParts[ESM::getMeshPart(index)];
|
||||
}
|
||||
|
||||
const std::pair<float, float>& ActorAdapter::RaceData::getRaceAttributes(bool isFemale)
|
||||
const osg::Vec2f& ActorAdapter::RaceData::getHeightWeight(bool isFemale)
|
||||
{
|
||||
return isFemale == true ? mHeightsWeights.mFemaleAttributes : mHeightsWeights.mMaleAttributes;
|
||||
return isFemale ? mHeightsWeights.mFemaleHeightWeight : mHeightsWeights.mMaleHeightWeight;
|
||||
}
|
||||
|
||||
bool ActorAdapter::RaceData::hasDependency(const ESM::RefId& id) const
|
||||
|
|
@ -95,7 +95,7 @@ namespace CSMWorld
|
|||
mDependencies.emplace(id);
|
||||
}
|
||||
|
||||
void ActorAdapter::RaceData::reset_data(const ESM::RefId& id, const BodyAttributes& raceStats, bool isBeast)
|
||||
void ActorAdapter::RaceData::reset_data(const ESM::RefId& id, const HeightsWeights& raceStats, bool isBeast)
|
||||
{
|
||||
mId = id;
|
||||
mIsBeast = isBeast;
|
||||
|
|
@ -169,9 +169,9 @@ namespace CSMWorld
|
|||
return it->second.first;
|
||||
}
|
||||
|
||||
const std::pair<float, float>& ActorAdapter::ActorData::getRaceHeightWeight() const
|
||||
const osg::Vec2f& ActorAdapter::ActorData::getRaceHeightWeight() const
|
||||
{
|
||||
return mRaceData->getRaceAttributes(isFemale());
|
||||
return mRaceData->getHeightWeight(isFemale());
|
||||
}
|
||||
|
||||
bool ActorAdapter::ActorData::hasDependency(const ESM::RefId& id) const
|
||||
|
|
@ -516,8 +516,8 @@ namespace CSMWorld
|
|||
|
||||
auto& race = raceRecord.get();
|
||||
|
||||
BodyAttributes scaleStats = BodyAttributes(
|
||||
race.mData.mMaleHeight, race.mData.mMaleWeight, race.mData.mFemaleHeight, race.mData.mFemaleWeight);
|
||||
HeightsWeights scaleStats = HeightsWeights(osg::Vec2f(race.mData.mMaleWeight, race.mData.mMaleHeight),
|
||||
osg::Vec2f(race.mData.mFemaleWeight, race.mData.mFemaleHeight));
|
||||
|
||||
data->reset_data(id, scaleStats, race.mData.mFlags & ESM::Race::Beast);
|
||||
|
||||
|
|
|
|||
|
|
@ -41,22 +41,22 @@ namespace CSMWorld
|
|||
/// Tracks unique strings
|
||||
using RefIdSet = std::unordered_set<ESM::RefId>;
|
||||
|
||||
class BodyAttributes
|
||||
class HeightsWeights
|
||||
{
|
||||
public:
|
||||
std::pair<float, float> mMaleAttributes;
|
||||
std::pair<float, float> mFemaleAttributes;
|
||||
osg::Vec2f mMaleHeightWeight;
|
||||
osg::Vec2f mFemaleHeightWeight;
|
||||
|
||||
BodyAttributes()
|
||||
: mMaleAttributes(std::make_pair(1.0f, 1.0f))
|
||||
, mFemaleAttributes(std::make_pair(1.0f, 1.0f))
|
||||
HeightsWeights()
|
||||
: mMaleHeightWeight(osg::Vec2f(1.0f, 1.0f))
|
||||
, mFemaleHeightWeight(osg::Vec2f(1.0f, 1.0f))
|
||||
{
|
||||
}
|
||||
|
||||
BodyAttributes(float maleHeight, float maleWeight, float femaleHeight, float femaleWeight)
|
||||
HeightsWeights(const osg::Vec2f& maleHeightWeight, const osg::Vec2f& femaleHeightWeight)
|
||||
{
|
||||
mMaleAttributes = std::make_pair(maleHeight, maleWeight);
|
||||
mFemaleAttributes = std::make_pair(femaleHeight, femaleWeight);
|
||||
mMaleHeightWeight = maleHeightWeight;
|
||||
mFemaleHeightWeight = femaleHeightWeight;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -77,7 +77,7 @@ namespace CSMWorld
|
|||
/// Retrieves the associated body part
|
||||
const ESM::RefId& getMalePart(ESM::PartReferenceType index) const;
|
||||
|
||||
const std::pair<float, float>& getRaceAttributes(bool isFemale);
|
||||
const osg::Vec2f& getHeightWeight(bool isFemale);
|
||||
/// Checks if the race has a data dependency
|
||||
bool hasDependency(const ESM::RefId& id) const;
|
||||
|
||||
|
|
@ -89,7 +89,7 @@ namespace CSMWorld
|
|||
void addOtherDependency(const ESM::RefId& id);
|
||||
/// Clears parts and dependencies
|
||||
void reset_data(
|
||||
const ESM::RefId& raceId, const BodyAttributes& raceStats = BodyAttributes(), bool isBeast = false);
|
||||
const ESM::RefId& raceId, const HeightsWeights& raceStats = HeightsWeights(), bool isBeast = false);
|
||||
|
||||
private:
|
||||
bool handles(ESM::PartReferenceType type) const;
|
||||
|
|
@ -97,7 +97,7 @@ namespace CSMWorld
|
|||
bool mIsBeast;
|
||||
RacePartList mFemaleParts;
|
||||
RacePartList mMaleParts;
|
||||
BodyAttributes mHeightsWeights;
|
||||
HeightsWeights mHeightsWeights;
|
||||
RefIdSet mDependencies;
|
||||
};
|
||||
using RaceDataPtr = std::shared_ptr<RaceData>;
|
||||
|
|
@ -120,7 +120,7 @@ namespace CSMWorld
|
|||
/// Retrieves the associated actor part
|
||||
ESM::RefId getPart(ESM::PartReferenceType index) const;
|
||||
|
||||
const std::pair<float, float>& getRaceHeightWeight() const;
|
||||
const osg::Vec2f& getRaceHeightWeight() const;
|
||||
/// Checks if the actor has a data dependency
|
||||
bool hasDependency(const ESM::RefId& id) const;
|
||||
|
||||
|
|
|
|||
|
|
@ -63,9 +63,9 @@ namespace CSVRender
|
|||
// Attach parts to skeleton
|
||||
loadBodyParts();
|
||||
|
||||
const std::pair<float, float> attributes = mActorData.get()->getRaceHeightWeight();
|
||||
const osg::Vec2f& attributes = mActorData.get()->getRaceHeightWeight();
|
||||
|
||||
mBaseNode->setScale(osg::Vec3d(attributes.second, attributes.second, attributes.first));
|
||||
mBaseNode->setScale(osg::Vec3d(attributes.x(), attributes.x(), attributes.y()));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue