v0.4.2: fixed some redundant observe calls
This commit is contained in:
parent
50f6329578
commit
a8e04b51ca
|
@ -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) {
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user