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

summaryrefslogtreecommitdiff
path: root/source/game/StarHumanoid.cpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2024-04-29 06:18:58 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2024-04-29 06:18:58 +1000
commit27e0f6bd713285c0b2aa0e358a17fe84bbbfbfdf (patch)
treed8b0d2b5c15d930b36c9330494f1821b2f1a5f70 /source/game/StarHumanoid.cpp
parentf7b7a2d4d54d71e005274297a790f7ec42bd6c1f (diff)
fix: scale not applying to NPCs properly and applying post-rotation
Diffstat (limited to 'source/game/StarHumanoid.cpp')
-rw-r--r--source/game/StarHumanoid.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/source/game/StarHumanoid.cpp b/source/game/StarHumanoid.cpp
index a18dd3f..0b33ba4 100644
--- a/source/game/StarHumanoid.cpp
+++ b/source/game/StarHumanoid.cpp
@@ -299,6 +299,7 @@ Humanoid::Humanoid(Json const& config) {
m_altHand.angle = 0;
m_facingDirection = Direction::Left;
m_rotation = 0;
+ m_scale = Vec2F::filled(1.f);
m_drawVaporTrail = false;
m_state = State::Idle;
m_emoteState = HumanoidEmote::Idle;
@@ -409,6 +410,10 @@ void Humanoid::setRotation(float rotation) {
m_rotation = rotation;
}
+void Humanoid::setScale(Vec2F scale) {
+ m_scale = scale;
+}
+
void Humanoid::setVaporTrail(bool enabled) {
m_drawVaporTrail = enabled;
}
@@ -499,7 +504,7 @@ void Humanoid::resetAnimation() {
m_danceTimer = 0.0f;
}
-List<Drawable> Humanoid::render(bool withItems, bool withRotation) {
+List<Drawable> Humanoid::render(bool withItems, bool withRotationAndScale) {
List<Drawable> drawables;
int armStateSeq = getArmStateSequence();
@@ -794,8 +799,12 @@ List<Drawable> Humanoid::render(bool withItems, bool withRotation) {
for (auto& drawable : drawables) {
drawable.translate(m_globalOffset);
- if (withRotation && m_rotation != 0)
- drawable.rotate(m_rotation);
+ if (withRotationAndScale) {
+ if (m_scale.x() != 1.f || m_scale.y() != 1.f)
+ drawable.scale(m_scale);
+ if (m_rotation != 0.f)
+ drawable.rotate(m_rotation);
+ }
drawable.rebase();
}
return drawables;