From 22183d8a28d1679c42a607054aec28073ae9bc0b Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Fri, 4 Jul 2025 13:59:05 -0400 Subject: [PATCH] v3.2.0: fixed floating text stacking to use visual logic entirely --- .../shatteredpixeldungeon/sprites/CharSprite.java | 3 ++- .../shatteredpixeldungeon/tiles/DungeonTilemap.java | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/CharSprite.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/CharSprite.java index 6e59a4955..84cdaeeeb 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/CharSprite.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/CharSprite.java @@ -201,8 +201,9 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip } float x = destinationCenter().x; float y = destinationCenter().y - height()/2f; + int pos = DungeonTilemap.worldToTile(x, y + height(), Dungeon.level.width()); if (ch != null) { - FloatingText.show( x, y, ch.pos, text, color, icon, true ); + FloatingText.show( x, y, pos, text, color, icon, true ); } else { FloatingText.show( x, y, -1, text, color, icon, true ); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/tiles/DungeonTilemap.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/tiles/DungeonTilemap.java index eab125d78..16ae6ceb1 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/tiles/DungeonTilemap.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/tiles/DungeonTilemap.java @@ -165,6 +165,10 @@ public abstract class DungeonTilemap extends Tilemap { (pos % Dungeon.level.width() + 0.5f) * SIZE, (pos / Dungeon.level.width() + 0.1f) * SIZE ); } + + public static int worldToTile( float x, float y, int width){ + return (int)(x / SIZE) + ((int)(y / SIZE) * width); + } @Override public boolean overlapsScreenPoint( int x, int y ) {