v1.3.0: fixed rare misalignment of item sprites
This commit is contained in:
@@ -131,14 +131,19 @@ public class CellSelector extends ScrollArea {
|
||||
SPDSettings.zoom((int) (value - PixelScene.defaultZoom));
|
||||
camera.zoom( value );
|
||||
|
||||
//Resets character sprite positions with the new camera zoom
|
||||
//This is important as characters are centered on a 16x16 tile, but may have any sprite size
|
||||
//Resets char and item sprite positions with the new camera zoom
|
||||
//This is important as sprites are centered on a 16x16 tile, but may have any sprite size
|
||||
//This can lead to none-whole coordinate, which need to be aligned with the zoom
|
||||
for (Char c : Actor.chars()){
|
||||
if (c.sprite != null && !c.sprite.isMoving){
|
||||
c.sprite.point(c.sprite.worldToCamera(c.pos));
|
||||
}
|
||||
}
|
||||
for (Heap heap : Dungeon.level.heaps.valueList()){
|
||||
if (heap.sprite != null){
|
||||
heap.sprite.point(heap.sprite.worldToCamera(heap.pos));
|
||||
}
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -30,11 +30,13 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap;
|
||||
import com.watabou.gltextures.SmartTexture;
|
||||
import com.watabou.gltextures.TextureCache;
|
||||
import com.watabou.glwrap.Matrix;
|
||||
import com.watabou.glwrap.Vertexbuffer;
|
||||
import com.watabou.noosa.Camera;
|
||||
import com.watabou.noosa.Game;
|
||||
import com.watabou.noosa.MovieClip;
|
||||
import com.watabou.noosa.NoosaScript;
|
||||
@@ -134,8 +136,8 @@ public class ItemSprite extends MovieClip {
|
||||
final int csize = DungeonTilemap.SIZE;
|
||||
|
||||
return new PointF(
|
||||
cell % Dungeon.level.width() * csize + (csize - width()) * 0.5f,
|
||||
cell / Dungeon.level.width() * csize + (csize - height()) - csize * perspectiveRaise
|
||||
PixelScene.align(Camera.main, ((cell % Dungeon.level.width()) + 0.5f) * csize - width() * 0.5f),
|
||||
PixelScene.align(Camera.main, ((cell / Dungeon.level.width()) + 1.0f) * csize - height() - csize * perspectiveRaise)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user