Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/game/StarHumanoid.cpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2023-06-28 20:22:25 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2023-06-28 20:22:25 +1000
commit98c4e55380baefc3aae58ead213052ea713e00c7 (patch)
tree78abbd8b56c50cd287a360cae4876f4cfb02a40b /source/game/StarHumanoid.cpp
parentc37dd994d74c256b25b9d94dc25b3cdb44519e67 (diff)
Don't show the held item and rotation in the new inventory portrait
Diffstat (limited to 'source/game/StarHumanoid.cpp')
-rw-r--r--source/game/StarHumanoid.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/source/game/StarHumanoid.cpp b/source/game/StarHumanoid.cpp
index 84c64bf..9f6f8a3 100644
--- a/source/game/StarHumanoid.cpp
+++ b/source/game/StarHumanoid.cpp
@@ -463,7 +463,7 @@ void Humanoid::resetAnimation() {
m_danceTimer = 0.0f;
}
-List<Drawable> Humanoid::render() {
+List<Drawable> Humanoid::render(bool withItems, bool withRotation) {
List<Drawable> drawables;
int armStateSeq = getArmStateSequence();
@@ -521,9 +521,9 @@ List<Drawable> Humanoid::render() {
addDrawable(move(drawable));
}
- if (backHand.holdingItem && !dance.isValid()) {
+ if (backHand.holdingItem && !dance.isValid() && withItems) {
auto drawItem = [&]() {
- for (auto backHandItem : backHand.itemDrawables) {
+ for (auto& backHandItem : backHand.itemDrawables) {
backHandItem.translate(m_frontHandPosition + backArmFrameOffset + m_backArmOffset);
backHandItem.rotate(backHand.itemAngle, backArmFrameOffset + m_backArmRotationCenter + m_backArmOffset);
addDrawable(move(backHandItem));
@@ -688,10 +688,9 @@ List<Drawable> Humanoid::render() {
return frontArm;
};
- if (frontHand.holdingItem && !dance.isValid()) {
+ if (frontHand.holdingItem && !dance.isValid() && withItems) {
auto drawItem = [&]() {
- for (size_t i = 0; i < frontHand.itemDrawables.size(); i++) {
- Drawable frontHandItem = frontHand.itemDrawables[i];
+ for (auto& frontHandItem : frontHand.itemDrawables) {
frontHandItem.translate(m_frontHandPosition + frontArmFrameOffset);
frontHandItem.rotate(frontHand.itemAngle, frontArmFrameOffset + m_frontArmRotationCenter);
addDrawable(frontHandItem);
@@ -755,7 +754,9 @@ List<Drawable> Humanoid::render() {
if (m_altHand.nonRotatedDrawables.size())
drawables.insertAllAt(0, m_altHand.nonRotatedDrawables);
- Drawable::rotateAll(drawables, m_rotation);
+ if (withRotation)
+ Drawable::rotateAll(drawables, m_rotation);
+
Drawable::translateAll(drawables, m_globalOffset);
Drawable::rebaseAll(drawables);
@@ -1296,7 +1297,7 @@ List<Particle> Humanoid::particles(String const& name) const {
auto particleDatabase = Root::singleton().particleDatabase();
List<Particle> res;
Json particles = m_particleEmitters.get(name).get("particles", {});
- for (auto particle : particles.toArray()) {
+ for (auto& particle : particles.toArray()) {
auto particleSpec = particle.get("particle", {});
res.push_back(particleDatabase->particle(particleSpec));
}