diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java index 72328e620..7662a9599 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java @@ -412,13 +412,13 @@ public abstract class Char extends Actor { } if (Dungeon.level.map[pos] == Terrain.OPEN_DOOR) { - Door.leave( pos ); + Door.leave( pos, this ); } pos = step; if (flying && Dungeon.level.map[pos] == Terrain.DOOR) { - Door.enter( pos ); + Door.enter( pos, this ); } if (this != Dungeon.hero) { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Swarm.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Swarm.java index 51786acbb..4a81582fc 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Swarm.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Swarm.java @@ -103,7 +103,7 @@ public class Swarm extends Mob { clone.state = clone.HUNTING; if (Dungeon.level.map[clone.pos] == Terrain.DOOR) { - Door.enter( clone.pos ); + Door.enter( clone.pos, clone ); } GameScene.add( clone, SPLIT_DELAY ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java index 5d7ea4043..92fd5b814 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java @@ -843,7 +843,7 @@ public abstract class Level implements Bundlable { break; case Terrain.DOOR: - Door.enter( cell ); + Door.enter( cell, ch ); break; } @@ -891,7 +891,7 @@ public abstract class Level implements Bundlable { break; case Terrain.DOOR: - Door.enter( cell ); + Door.enter( cell, mob ); break; } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/features/Door.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/features/Door.java index 51b7463cc..119c90200 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/features/Door.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/features/Door.java @@ -22,6 +22,7 @@ package com.shatteredpixel.shatteredpixeldungeon.levels.features; import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; @@ -29,21 +30,26 @@ import com.watabou.noosa.audio.Sample; public class Door { - public static void enter( int pos ) { + public static void enter( int pos, Char ch ) { Level.set( pos, Terrain.OPEN_DOOR ); GameScene.updateMap( pos ); - Dungeon.observe(); - - if (Dungeon.visible[pos]) { + + if (ch == Dungeon.hero){ + //don't obsserve here as that already happens on hero move + Sample.INSTANCE.play( Assets.SND_OPEN ); + } else if (Dungeon.visible[pos]) { Sample.INSTANCE.play( Assets.SND_OPEN ); - } - } - - public static void leave( int pos ) { - if (Dungeon.level.heaps.get( pos ) == null) { - Level.set( pos, Terrain.DOOR ); - GameScene.updateMap( pos ); Dungeon.observe(); } } + + public static void leave( int pos, Char ch ) { + if (Dungeon.level.heaps.get( pos ) == null) { + Level.set( pos, Terrain.DOOR ); + GameScene.updateMap( pos ); + + if (ch != Dungeon.hero && Dungeon.visible[pos]) + Dungeon.observe(); + } + } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/features/HighGrass.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/features/HighGrass.java index c05e37251..5603f2c99 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/features/HighGrass.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/features/HighGrass.java @@ -103,6 +103,8 @@ public class HighGrass { } CellEmitter.get( pos ).burst( LeafParticle.LEVEL_SPECIFIC, leaves ); - Dungeon.observe(); + //observe already happens when hero moves + if (ch != Dungeon.hero) + Dungeon.observe(); } }