diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-08-02 21:28:37 +1000 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-08-02 21:28:37 +1000 |
commit | c80b2d2dbc32c45b4eaeb802af6dcdf921b8410b (patch) | |
tree | 41cbe5205b48c6e7d49ccf04d9a2818e68afbc05 /source/game/StarProjectile.cpp | |
parent | 994c533a0f7b4aa1a1530405505a53546252e1d1 (diff) |
Add loading icon when swapping character
Diffstat (limited to 'source/game/StarProjectile.cpp')
-rw-r--r-- | source/game/StarProjectile.cpp | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/source/game/StarProjectile.cpp b/source/game/StarProjectile.cpp index fa01480..234c053 100644 --- a/source/game/StarProjectile.cpp +++ b/source/game/StarProjectile.cpp @@ -358,7 +358,9 @@ void Projectile::render(RenderCallback* renderCallback) { m_effectEmitter->render(renderCallback); - Drawable drawable = Drawable::makeImage(drawableFrame(), 1.0f / TilePixels, true, Vec2F()); + String image = strf("{}:{}{}", m_config->image, m_frame, m_imageSuffix); + Drawable drawable = Drawable::makeImage(image, 1.0f / TilePixels, true, Vec2F()); + drawable.imagePart().addDirectives(m_imageDirectives, true); if (m_config->flippable) { auto angleSide = getAngleSide(m_movementController->rotation(), true); if (angleSide.second == Direction::Left) @@ -539,7 +541,8 @@ void Projectile::setFrame(int frame) { } String Projectile::drawableFrame() { - return strf("{}:{}{}", m_config->image, m_frame, m_imageDirectives); + String str = strf("{}:{}{}", m_config->image, m_frame, m_imageSuffix); + return m_imageDirectives.addToString(str); } bool Projectile::ephemeral() const { @@ -896,7 +899,22 @@ void Projectile::setup() { m_acceleration = m_parameters.getFloat("acceleration", m_config->acceleration); m_power = m_parameters.getFloat("power", m_config->power); m_powerMultiplier = m_parameters.getFloat("powerMultiplier", 1.0f); - m_imageDirectives = m_parameters.getString("processing", ""); + { // it is possible to shove a frame name in processing. I hope nobody actually does this but account for it... + String processing = m_parameters.getString("processing", ""); + auto begin = processing.utf8().find_first_of('?'); + if (begin == NPos) { + m_imageDirectives = ""; + m_imageSuffix = move(processing); + } + else if (begin == 0) { + m_imageDirectives = move(processing); + m_imageSuffix = ""; + } + else { + m_imageDirectives = (String)processing.utf8().substr(begin); + m_imageSuffix = processing.utf8().substr(0, begin); + } + } m_persistentAudioFile = m_parameters.getString("persistentAudio", m_config->persistentAudio); m_damageKind = m_parameters.getString("damageKind", m_config->damageKind); |