Don't show the held item and rotation in the new inventory portrait
This commit is contained in:
parent
c37dd994d7
commit
98c4e55380
@ -463,7 +463,7 @@ void Humanoid::resetAnimation() {
|
|||||||
m_danceTimer = 0.0f;
|
m_danceTimer = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Drawable> Humanoid::render() {
|
List<Drawable> Humanoid::render(bool withItems, bool withRotation) {
|
||||||
List<Drawable> drawables;
|
List<Drawable> drawables;
|
||||||
|
|
||||||
int armStateSeq = getArmStateSequence();
|
int armStateSeq = getArmStateSequence();
|
||||||
@ -521,9 +521,9 @@ List<Drawable> Humanoid::render() {
|
|||||||
addDrawable(move(drawable));
|
addDrawable(move(drawable));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (backHand.holdingItem && !dance.isValid()) {
|
if (backHand.holdingItem && !dance.isValid() && withItems) {
|
||||||
auto drawItem = [&]() {
|
auto drawItem = [&]() {
|
||||||
for (auto backHandItem : backHand.itemDrawables) {
|
for (auto& backHandItem : backHand.itemDrawables) {
|
||||||
backHandItem.translate(m_frontHandPosition + backArmFrameOffset + m_backArmOffset);
|
backHandItem.translate(m_frontHandPosition + backArmFrameOffset + m_backArmOffset);
|
||||||
backHandItem.rotate(backHand.itemAngle, backArmFrameOffset + m_backArmRotationCenter + m_backArmOffset);
|
backHandItem.rotate(backHand.itemAngle, backArmFrameOffset + m_backArmRotationCenter + m_backArmOffset);
|
||||||
addDrawable(move(backHandItem));
|
addDrawable(move(backHandItem));
|
||||||
@ -688,10 +688,9 @@ List<Drawable> Humanoid::render() {
|
|||||||
return frontArm;
|
return frontArm;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (frontHand.holdingItem && !dance.isValid()) {
|
if (frontHand.holdingItem && !dance.isValid() && withItems) {
|
||||||
auto drawItem = [&]() {
|
auto drawItem = [&]() {
|
||||||
for (size_t i = 0; i < frontHand.itemDrawables.size(); i++) {
|
for (auto& frontHandItem : frontHand.itemDrawables) {
|
||||||
Drawable frontHandItem = frontHand.itemDrawables[i];
|
|
||||||
frontHandItem.translate(m_frontHandPosition + frontArmFrameOffset);
|
frontHandItem.translate(m_frontHandPosition + frontArmFrameOffset);
|
||||||
frontHandItem.rotate(frontHand.itemAngle, frontArmFrameOffset + m_frontArmRotationCenter);
|
frontHandItem.rotate(frontHand.itemAngle, frontArmFrameOffset + m_frontArmRotationCenter);
|
||||||
addDrawable(frontHandItem);
|
addDrawable(frontHandItem);
|
||||||
@ -755,7 +754,9 @@ List<Drawable> Humanoid::render() {
|
|||||||
if (m_altHand.nonRotatedDrawables.size())
|
if (m_altHand.nonRotatedDrawables.size())
|
||||||
drawables.insertAllAt(0, m_altHand.nonRotatedDrawables);
|
drawables.insertAllAt(0, m_altHand.nonRotatedDrawables);
|
||||||
|
|
||||||
Drawable::rotateAll(drawables, m_rotation);
|
if (withRotation)
|
||||||
|
Drawable::rotateAll(drawables, m_rotation);
|
||||||
|
|
||||||
Drawable::translateAll(drawables, m_globalOffset);
|
Drawable::translateAll(drawables, m_globalOffset);
|
||||||
Drawable::rebaseAll(drawables);
|
Drawable::rebaseAll(drawables);
|
||||||
|
|
||||||
@ -1296,7 +1297,7 @@ List<Particle> Humanoid::particles(String const& name) const {
|
|||||||
auto particleDatabase = Root::singleton().particleDatabase();
|
auto particleDatabase = Root::singleton().particleDatabase();
|
||||||
List<Particle> res;
|
List<Particle> res;
|
||||||
Json particles = m_particleEmitters.get(name).get("particles", {});
|
Json particles = m_particleEmitters.get(name).get("particles", {});
|
||||||
for (auto particle : particles.toArray()) {
|
for (auto& particle : particles.toArray()) {
|
||||||
auto particleSpec = particle.get("particle", {});
|
auto particleSpec = particle.get("particle", {});
|
||||||
res.push_back(particleDatabase->particle(particleSpec));
|
res.push_back(particleDatabase->particle(particleSpec));
|
||||||
}
|
}
|
||||||
|
@ -192,7 +192,7 @@ public:
|
|||||||
|
|
||||||
// Renders to centered drawables (centered on the normal image center for the
|
// Renders to centered drawables (centered on the normal image center for the
|
||||||
// player graphics), (in world space, not pixels)
|
// player graphics), (in world space, not pixels)
|
||||||
List<Drawable> render();
|
List<Drawable> render(bool withItems = true, bool withRotation = true);
|
||||||
|
|
||||||
// Renders to centered drawables (centered on the normal image center for the
|
// Renders to centered drawables (centered on the normal image center for the
|
||||||
// player graphics), (in pixels, not world space)
|
// player graphics), (in pixels, not world space)
|
||||||
|
@ -8,6 +8,7 @@ namespace Star {
|
|||||||
|
|
||||||
PortraitWidget::PortraitWidget(PortraitEntityPtr entity, PortraitMode mode) : m_entity(entity), m_portraitMode(mode) {
|
PortraitWidget::PortraitWidget(PortraitEntityPtr entity, PortraitMode mode) : m_entity(entity), m_portraitMode(mode) {
|
||||||
m_scale = 1;
|
m_scale = 1;
|
||||||
|
m_renderHumanoid = false;
|
||||||
m_iconMode = false;
|
m_iconMode = false;
|
||||||
|
|
||||||
init();
|
init();
|
||||||
@ -44,7 +45,7 @@ void PortraitWidget::renderImpl() {
|
|||||||
humanoid = player->humanoid();
|
humanoid = player->humanoid();
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Drawable> portrait = humanoid ? humanoid->render() : m_entity->portrait(m_portraitMode);
|
List<Drawable> portrait = humanoid ? humanoid->render(false, false) : m_entity->portrait(m_portraitMode);
|
||||||
for (auto& i : portrait) {
|
for (auto& i : portrait) {
|
||||||
i.scale(humanoid ? m_scale * 8.0f : m_scale);
|
i.scale(humanoid ? m_scale * 8.0f : m_scale);
|
||||||
context()->drawInterfaceDrawable(i, Vec2F(screenPosition() + offset));
|
context()->drawInterfaceDrawable(i, Vec2F(screenPosition() + offset));
|
||||||
|
Loading…
Reference in New Issue
Block a user