Humanoid: apply globalOffset *before* rotation

the globalOffset is meant to realign the sprite with the collision poly - applying it after rotating the drawables is bad! (I actually ACCIDENTALLY fixed this in StarExtensions and only noticed the difference today. quite incredible)
This commit is contained in:
Kae 2024-04-11 16:27:46 +10:00
parent e3ab448553
commit d255328476
2 changed files with 8 additions and 8 deletions

View File

@ -434,7 +434,7 @@ void OpenGlRenderer::setMultiSampling(unsigned multiSampling) {
glEnable(GL_SAMPLE_SHADING); glEnable(GL_SAMPLE_SHADING);
glMinSampleShading((float)m_multiSampling); glMinSampleShading((float)m_multiSampling);
} else { } else {
glMinSampleShading(1.f); glMinSampleShading(0.f);
glDisable(GL_SAMPLE_SHADING); glDisable(GL_SAMPLE_SHADING);
glDisable(GL_MULTISAMPLE); glDisable(GL_MULTISAMPLE);
} }

View File

@ -528,7 +528,7 @@ List<Drawable> Humanoid::render(bool withItems, bool withRotation) {
auto addDrawable = [&](Drawable drawable, bool forceFullbright = false) { auto addDrawable = [&](Drawable drawable, bool forceFullbright = false) {
if (m_facingDirection == Direction::Left) if (m_facingDirection == Direction::Left)
drawable.scale(Vec2F(-1, 1)); drawable.scale(Vec2F(-1, 1));
drawable.fullbright = drawable.fullbright || forceFullbright; drawable.fullbright |= forceFullbright;
drawables.append(std::move(drawable)); drawables.append(std::move(drawable));
}; };
@ -792,12 +792,12 @@ List<Drawable> Humanoid::render(bool withItems, bool withRotation) {
drawables.insertAllAt(0, m_altHand.nonRotatedDrawables); drawables.insertAllAt(0, m_altHand.nonRotatedDrawables);
} }
if (withRotation) for (auto& drawable : drawables) {
Drawable::rotateAll(drawables, m_rotation); drawable.translate(m_globalOffset);
if (withRotation && m_rotation != 0)
Drawable::translateAll(drawables, m_globalOffset); drawable.rotate(m_rotation);
Drawable::rebaseAll(drawables); drawable.rebase();
}
return drawables; return drawables;
} }