From 68499b213a2cf519e2c4167748e85500b0212a0a Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sat, 16 Sep 2017 03:57:53 -0400 Subject: [PATCH] v0.6.2: made field of vision storage none-static --- .../shatteredpixeldungeon/Dungeon.java | 8 ++--- .../shatteredpixeldungeon/actors/Char.java | 14 +++++--- .../actors/blobs/Alchemy.java | 2 +- .../actors/blobs/Foliage.java | 2 +- .../actors/blobs/Freezing.java | 2 +- .../actors/blobs/WaterOfAwareness.java | 2 +- .../actors/buffs/Preparation.java | 3 +- .../actors/hero/Hero.java | 16 +++++----- .../actors/mobs/Bee.java | 3 +- .../actors/mobs/Brute.java | 2 +- .../actors/mobs/DM300.java | 4 +-- .../actors/mobs/Eye.java | 7 ++-- .../actors/mobs/Goo.java | 4 +-- .../actors/mobs/Guard.java | 8 ++--- .../actors/mobs/King.java | 2 +- .../actors/mobs/Mimic.java | 2 +- .../actors/mobs/Mob.java | 23 +++++++------ .../actors/mobs/Piranha.java | 11 ++++--- .../actors/mobs/Shaman.java | 3 +- .../actors/mobs/Skeleton.java | 2 +- .../actors/mobs/Statue.java | 2 +- .../actors/mobs/Succubus.java | 3 +- .../actors/mobs/Tengu.java | 6 ++-- .../actors/mobs/Thief.java | 10 +++--- .../actors/mobs/Warlock.java | 3 +- .../actors/mobs/npcs/Ghost.java | 2 +- .../actors/mobs/npcs/Imp.java | 2 +- .../actors/mobs/npcs/ImpShopkeeper.java | 2 +- .../actors/mobs/npcs/MirrorImage.java | 3 +- .../effects/BlobEmitter.java | 4 +-- .../effects/particles/FlowParticle.java | 2 +- .../effects/particles/WindParticle.java | 2 +- .../shatteredpixeldungeon/items/Bomb.java | 4 +-- .../shatteredpixeldungeon/items/Heap.java | 2 +- .../shatteredpixeldungeon/items/Honeypot.java | 2 +- .../items/armor/HuntressArmor.java | 3 +- .../items/armor/MageArmor.java | 3 +- .../items/armor/RogueArmor.java | 5 ++- .../items/artifacts/DriedRose.java | 2 +- .../items/artifacts/LloydsBeacon.java | 2 +- .../items/artifacts/TalismanOfForesight.java | 4 +-- .../items/potions/Potion.java | 2 +- .../items/potions/PotionOfLevitation.java | 2 +- .../items/potions/PotionOfLiquidFlame.java | 2 +- .../items/potions/PotionOfParalyticGas.java | 2 +- .../items/potions/PotionOfPurity.java | 4 +-- .../items/potions/PotionOfToxicGas.java | 2 +- .../items/quest/CorpseDust.java | 2 +- .../items/scrolls/ScrollOfLullaby.java | 5 ++- .../items/scrolls/ScrollOfMagicMapping.java | 2 +- .../items/scrolls/ScrollOfPsionicBlast.java | 5 ++- .../items/scrolls/ScrollOfRage.java | 5 ++- .../items/scrolls/ScrollOfTerror.java | 5 ++- .../items/wands/CursedWand.java | 2 +- .../items/weapon/curses/Displacing.java | 4 +-- .../levels/CavesBossLevel.java | 2 +- .../levels/CavesLevel.java | 2 +- .../levels/CityBossLevel.java | 4 +-- .../levels/CityLevel.java | 2 +- .../levels/HallsBossLevel.java | 2 +- .../levels/HallsLevel.java | 2 +- .../shatteredpixeldungeon/levels/Level.java | 32 +++++++++---------- .../levels/PrisonLevel.java | 2 +- .../levels/RegularLevel.java | 2 +- .../levels/SewerLevel.java | 2 +- .../levels/features/Door.java | 4 +-- .../levels/features/HighGrass.java | 3 +- .../levels/traps/AlarmTrap.java | 2 +- .../levels/traps/ChillingTrap.java | 2 +- .../levels/traps/CursingTrap.java | 2 +- .../levels/traps/DisintegrationTrap.java | 4 +-- .../levels/traps/FlashingTrap.java | 2 +- .../levels/traps/FrostTrap.java | 2 +- .../levels/traps/GuardianTrap.java | 2 +- .../levels/traps/RockfallTrap.java | 2 +- .../levels/traps/SpearTrap.java | 4 +-- .../levels/traps/TeleportationTrap.java | 2 +- .../levels/traps/Trap.java | 2 +- .../levels/traps/WeakeningTrap.java | 2 +- .../plants/Blindweed.java | 2 +- .../plants/Earthroot.java | 2 +- .../plants/Fadeleaf.java | 4 +-- .../plants/Firebloom.java | 2 +- .../shatteredpixeldungeon/plants/Plant.java | 4 +-- .../plants/Sorrowmoss.java | 2 +- .../plants/Sungrass.java | 2 +- .../scenes/GameScene.java | 6 ++-- .../scenes/InterlevelScene.java | 2 -- .../sprites/SkeletonSprite.java | 2 +- .../sprites/UndeadSprite.java | 2 +- .../shatteredpixeldungeon/tiles/FogOfWar.java | 2 +- .../ui/QuickSlotButton.java | 2 +- 92 files changed, 168 insertions(+), 185 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java index 44d949190..053d783be 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java @@ -365,8 +365,6 @@ public class Dungeon { DriedRose.restoreGhostHero( level, pos ); Actor.init(); - visible = new boolean[level.length()]; - Actor respawner = level.respawner(); if (respawner != null) { Actor.add( level.respawner() ); @@ -747,10 +745,10 @@ public class Dungeon { return; } - level.updateFieldOfView(hero, visible); + level.updateFieldOfView(hero, level.heroFOV); if (hero.buff(MindVision.class) != null || hero.buff(Awareness.class) != null) { - BArray.or( level.visited, visible, 0, visible.length, level.visited ); + BArray.or( level.visited, level.heroFOV, 0, level.heroFOV.length, level.visited ); GameScene.updateFog(); } else { @@ -767,7 +765,7 @@ public class Dungeon { int pos = ax + ay * level.width(); for (int y = ay; y <= by; y++, pos+=level.width()) { - BArray.or( level.visited, visible, pos, len, level.visited ); + BArray.or( level.visited, level.heroFOV, pos, len, level.visited ); } GameScene.updateFog(ax, ay, len, by-ay); 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 20208f2a1..09269f0c3 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java @@ -41,7 +41,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Speed; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Vertigo; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass; -import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain; import com.shatteredpixel.shatteredpixeldungeon.levels.features.Door; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; @@ -79,11 +78,16 @@ public abstract class Char extends Actor { public int viewDistance = 8; + protected boolean[] fieldOfView = null; + private HashSet buffs = new HashSet<>(); @Override protected boolean act() { - Dungeon.level.updateFieldOfView( this, Level.fieldOfView ); + if (fieldOfView == null || fieldOfView.length != Dungeon.level.length()){ + fieldOfView = new boolean[Dungeon.level.length()]; + } + Dungeon.level.updateFieldOfView( this, fieldOfView ); return false; } @@ -126,7 +130,7 @@ public abstract class Char extends Actor { if (enemy == null || !enemy.isAlive()) return false; - boolean visibleFight = Dungeon.visible[pos] || Dungeon.visible[enemy.pos]; + boolean visibleFight = Dungeon.level.heroFOV[pos] || Dungeon.level.heroFOV[enemy.pos]; if (hit( this, enemy, false )) { @@ -266,7 +270,7 @@ public abstract class Char extends Actor { if (buff( Paralysis.class ) != null) { if (Random.Int( dmg ) >= Random.Int( HP )) { Buff.detach( this, Paralysis.class ); - if (Dungeon.visible[pos]) { + if (Dungeon.level.heroFOV[pos]) { GLog.i( Messages.get(Char.class, "out_of_paralysis", name) ); } } @@ -433,7 +437,7 @@ public abstract class Char extends Actor { } if (this != Dungeon.hero) { - sprite.visible = Dungeon.visible[pos]; + sprite.visible = Dungeon.level.heroFOV[pos]; } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Alchemy.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Alchemy.java index b95d4f936..b056b1b25 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Alchemy.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Alchemy.java @@ -39,7 +39,7 @@ public class Alchemy extends Blob { if (Dungeon.level.insideMap(cell)) { off[cell] = cur[cell]; volume += off[cell]; - if (off[cell] > 0 && Dungeon.visible[cell]){ + if (off[cell] > 0 && Dungeon.level.heroFOV[cell]){ Notes.add( Notes.Landmark.ALCHEMY ); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Foliage.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Foliage.java index 3bbcffe10..4b774cc33 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Foliage.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Foliage.java @@ -55,7 +55,7 @@ public class Foliage extends Blob { GameScene.updateMap(cell); } - visible = visible || Dungeon.visible[cell]; + visible = visible || Dungeon.level.heroFOV[cell]; } else { off[cell] = 0; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Freezing.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Freezing.java index b6b583bb3..ff96be106 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Freezing.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Freezing.java @@ -54,7 +54,7 @@ public class Freezing { heap.freeze(); } - if (Dungeon.visible[cell]) { + if (Dungeon.level.heroFOV[cell]) { CellEmitter.get( cell ).start( SnowParticle.FACTORY, 0.2f, 6 ); return true; } else { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/WaterOfAwareness.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/WaterOfAwareness.java index 15a83c2ea..4d94db64b 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/WaterOfAwareness.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/WaterOfAwareness.java @@ -56,7 +56,7 @@ public class WaterOfAwareness extends WellWater { Dungeon.level.discover( i ); - if (Dungeon.visible[i]) { + if (Dungeon.level.heroFOV[i]) { GameScene.discoverTile( i, terr ); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Preparation.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Preparation.java index 585f4cfd8..798fb9875 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Preparation.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Preparation.java @@ -29,7 +29,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Rat; import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter; import com.shatteredpixel.shatteredpixeldungeon.effects.Effects; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; -import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.CellSelector; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; @@ -272,7 +271,7 @@ public class Preparation extends Buff implements ActionIndicator.Action { Dungeon.hero.pos = attackPos; Dungeon.level.press(Dungeon.hero.pos, Dungeon.hero); //prevents the hero from being interrupted by seeing new enemies - Dungeon.level.updateFieldOfView(Dungeon.hero, Level.fieldOfView); + Dungeon.observe(); Dungeon.hero.checkVisibleMobs(); Dungeon.hero.sprite.place( Dungeon.hero.pos ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java index a0efbdd54..8b1f94f62 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java @@ -608,7 +608,7 @@ public class Hero extends Char { } else { - if (Level.fieldOfView[npc.pos] && getCloser( npc.pos )) { + if (fieldOfView[npc.pos] && getCloser( npc.pos )) { return true; @@ -875,7 +875,7 @@ public class Hero extends Char { } else { - if (Level.fieldOfView[enemy.pos] && getCloser( enemy.pos )) { + if (fieldOfView[enemy.pos] && getCloser( enemy.pos )) { return true; @@ -980,7 +980,7 @@ public class Hero extends Char { Mob target = null; for (Mob m : Dungeon.level.mobs) { - if (Level.fieldOfView[ m.pos ] && m.hostile) { + if (Dungeon.level.heroFOV[ m.pos ] && m.hostile) { visible.add(m); if (!visibleEnemies.contains( m )) { newMob = true; @@ -998,7 +998,7 @@ public class Hero extends Char { if (target != null && (QuickSlotButton.lastTarget == null || !QuickSlotButton.lastTarget.isAlive() || - !Dungeon.visible[QuickSlotButton.lastTarget.pos])){ + !Dungeon.level.heroFOV[QuickSlotButton.lastTarget.pos])){ QuickSlotButton.target(target); } @@ -1062,7 +1062,7 @@ public class Hero extends Char { int lookAhead = (int) GameMath.gate(0, path.size()-1, 2); for (int i = 0; i < lookAhead; i++){ int cell = path.get(i); - if (!Dungeon.level.passable[cell] || (Dungeon.visible[cell] && Actor.findChar(cell) != null)) { + if (!Dungeon.level.passable[cell] || (fieldOfView[cell] && Actor.findChar(cell) != null)) { newPath = true; break; } @@ -1080,7 +1080,7 @@ public class Hero extends Char { passable[i] = p[i] && (v[i] || m[i]); } - path = Dungeon.findPath(this, pos, target, passable, Level.fieldOfView); + path = Dungeon.findPath(this, pos, target, passable, fieldOfView); } if (path == null) return false; @@ -1135,7 +1135,7 @@ public class Hero extends Char { curAction = new HeroAction.Alchemy( cell ); - } else if (Level.fieldOfView[cell] && (ch = Actor.findChar( cell )) instanceof Mob) { + } else if (Dungeon.level.heroFOV[cell] && (ch = Actor.findChar( cell )) instanceof Mob) { if (ch instanceof NPC) { curAction = new HeroAction.Interact( (NPC)ch ); @@ -1508,7 +1508,7 @@ public class Hero extends Char { for (int y = ay; y <= by; y++) { for (int x = ax, p = ax + y * Dungeon.level.width(); x <= bx; x++, p++) { - if (Dungeon.visible[p] && p != pos) { + if (Dungeon.level.heroFOV[p] && p != pos) { if (intentional) { sprite.parent.addToBack( new CheckedCell( p ) ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Bee.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Bee.java index 6c755861a..3fc3431f3 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Bee.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Bee.java @@ -26,7 +26,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Amok; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Poison; -import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.sprites.BeeSprite; import com.watabou.utils.Bundle; import com.watabou.utils.Random; @@ -122,7 +121,7 @@ public class Bee extends Mob { //if already targeting something, and that thing is still alive and near the pot, keeping targeting it. if (enemy != null && enemy.isAlive() && Dungeon.level.mobs.contains(enemy) - && Level.fieldOfView[enemy.pos] && enemy.invisible == 0 + && fieldOfView[enemy.pos] && enemy.invisible == 0 && Dungeon.level.distance(enemy.pos, potPos) <= 3) return enemy; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Brute.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Brute.java index d4cd6206d..f560629c7 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Brute.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Brute.java @@ -80,7 +80,7 @@ public class Brute extends Mob { if (isAlive() && !enraged && HP < HT / 4) { enraged = true; spend( TICK ); - if (Dungeon.visible[pos]) { + if (Dungeon.level.heroFOV[pos]) { sprite.showStatus( CharSprite.NEGATIVE, Messages.get(this, "enraged") ); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/DM300.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/DM300.java index 64364adfc..2de2f8848 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/DM300.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/DM300.java @@ -101,7 +101,7 @@ public class DM300 extends Mob { HP += Random.Int( 1, HT - HP ); sprite.emitter().burst( ElmoParticle.FACTORY, 5 ); - if (Dungeon.visible[step] && Dungeon.hero.isAlive()) { + if (Dungeon.level.heroFOV[step] && Dungeon.hero.isAlive()) { GLog.n( Messages.get(this, "repair") ); } } @@ -115,7 +115,7 @@ public class DM300 extends Mob { }; int cell = cells[Random.Int( cells.length )]; - if (Dungeon.visible[cell]) { + if (Dungeon.level.heroFOV[cell]) { CellEmitter.get( cell ).start( Speck.factory( Speck.ROCK ), 0.07f, 10 ); Camera.main.shake( 3, 0.7f ); Sample.INSTANCE.play( Assets.SND_ROCKS ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Eye.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Eye.java index 2f236b122..b4612df2c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Eye.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Eye.java @@ -32,7 +32,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Dewdrop; import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfDisintegration; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Grim; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Vampiric; -import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; @@ -92,7 +91,7 @@ public class Eye extends Mob { if (beamCooldown == 0) { Ballistica aim = new Ballistica(pos, enemy.pos, Ballistica.STOP_TERRAIN); - if (enemy.invisible == 0 && !isCharmedBy(enemy) && Level.fieldOfView[enemy.pos] && aim.subPath(1, aim.dist).contains(enemy.pos)){ + if (enemy.invisible == 0 && !isCharmedBy(enemy) && fieldOfView[enemy.pos] && aim.subPath(1, aim.dist).contains(enemy.pos)){ beam = aim; beamTarget = aim.collisionPos; return true; @@ -135,7 +134,7 @@ public class Eye extends Mob { spend( attackDelay() ); beam = new Ballistica(pos, beamTarget, Ballistica.STOP_TERRAIN); - if (Dungeon.visible[pos] || Dungeon.visible[beam.collisionPos] ) { + if (Dungeon.level.heroFOV[pos] || Dungeon.level.heroFOV[beam.collisionPos] ) { sprite.zap( beam.collisionPos ); return false; } else { @@ -179,7 +178,7 @@ public class Eye extends Mob { if (hit( this, ch, true )) { ch.damage( Random.NormalIntRange( 30, 50 ), this ); - if (Dungeon.visible[pos]) { + if (Dungeon.level.heroFOV[pos]) { ch.sprite.flash(); CellEmitter.center( pos ).burst( PurpleParticle.BURST, Random.IntRange( 1, 2 ) ); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Goo.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Goo.java index 5c8e52575..5c59f7590 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Goo.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Goo.java @@ -157,7 +157,7 @@ public class Goo extends Mob { return true; } else if (pumpedUp >= 2 || Random.Int( (HP*2 <= HT) ? 2 : 5 ) > 0) { - boolean visible = Dungeon.visible[pos]; + boolean visible = Dungeon.level.heroFOV[pos]; if (visible) { if (pumpedUp >= 2) { @@ -186,7 +186,7 @@ public class Goo extends Mob { } } - if (Dungeon.visible[pos]) { + if (Dungeon.level.heroFOV[pos]) { sprite.showStatus( CharSprite.NEGATIVE, Messages.get(this, "!!!") ); GLog.n( Messages.get(this, "pumpup") ); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Guard.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Guard.java index f462bb3a0..f6969284a 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Guard.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Guard.java @@ -31,7 +31,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Generator; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHealing; -import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; @@ -67,7 +66,8 @@ public class Guard extends Mob { @Override protected boolean act() { - Dungeon.level.updateFieldOfView( this, Level.fieldOfView ); + //FIXME should handle chaining in an extended hunting aistate + /*Dungeon.level.updateFieldOfView( this, fieldOfView ); if (state == HUNTING && paralysed <= 0 && @@ -82,9 +82,9 @@ public class Guard extends Mob { return false; - } else { + } else {*/ return super.act(); - } + //} } private boolean chain(int target){ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/King.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/King.java index ab74301bb..14dac9ca9 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/King.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/King.java @@ -315,7 +315,7 @@ public class King extends Mob { public void die( Object cause ) { super.die( cause ); - if (Dungeon.visible[pos]) { + if (Dungeon.level.heroFOV[pos]) { Sample.INSTANCE.play( Assets.SND_BONES ); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mimic.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mimic.java index 1ae3f8b91..76d21e75b 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mimic.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mimic.java @@ -147,7 +147,7 @@ public class Mimic extends Mob { m.sprite.turnTo( pos, Dungeon.hero.pos ); - if (Dungeon.visible[m.pos]) { + if (Dungeon.level.heroFOV[m.pos]) { CellEmitter.get( pos ).burst( Speck.factory( Speck.STAR ), 10 ); Sample.INSTANCE.play( Assets.SND_MIMIC ); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java index fe159d793..286c9c5e6 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java @@ -47,7 +47,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourglass; import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfAccuracy; import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfWealth; -import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; @@ -171,7 +170,7 @@ public abstract class Mob extends Char { enemy = chooseEnemy(); - boolean enemyInFOV = enemy != null && enemy.isAlive() && Level.fieldOfView[enemy.pos] && enemy.invisible <= 0; + boolean enemyInFOV = enemy != null && enemy.isAlive() && fieldOfView[enemy.pos] && enemy.invisible <= 0; return state.act( enemyInFOV, justAlerted ); } @@ -207,7 +206,7 @@ public abstract class Mob extends Char { //look for enemy mobs to attack, which are also not corrupted for (Mob mob : Dungeon.level.mobs) - if (mob != this && Level.fieldOfView[mob.pos] && mob.hostile && mob.buff(Corruption.class) == null) + if (mob != this && fieldOfView[mob.pos] && mob.hostile && mob.buff(Corruption.class) == null) enemies.add(mob); if (enemies.size() > 0) return Random.element(enemies); @@ -219,13 +218,13 @@ public abstract class Mob extends Char { //try to find an enemy mob to attack first. for (Mob mob : Dungeon.level.mobs) - if (mob != this && Level.fieldOfView[mob.pos] && mob.hostile) + if (mob != this && fieldOfView[mob.pos] && mob.hostile) enemies.add(mob); if (enemies.size() > 0) return Random.element(enemies); //try to find ally mobs to attack second. for (Mob mob : Dungeon.level.mobs) - if (mob != this && Level.fieldOfView[mob.pos] && mob.ally) + if (mob != this && fieldOfView[mob.pos] && mob.ally) enemies.add(mob); if (enemies.size() > 0) return Random.element(enemies); @@ -236,7 +235,7 @@ public abstract class Mob extends Char { //try to find ally mobs to attack. for (Mob mob : Dungeon.level.mobs) - if (mob != this && Level.fieldOfView[mob.pos] && mob.ally) + if (mob != this && fieldOfView[mob.pos] && mob.ally) enemies.add(mob); //and add the hero to the list of targets. @@ -261,7 +260,7 @@ public abstract class Mob extends Char { protected boolean moveSprite( int from, int to ) { - if (sprite.isVisible() && (Dungeon.visible[from] || Dungeon.visible[to])) { + if (sprite.isVisible() && (Dungeon.level.heroFOV[from] || Dungeon.level.heroFOV[to])) { sprite.move( from, to ); return true; } else { @@ -366,7 +365,7 @@ public abstract class Mob extends Char { int lookAhead = (int)GameMath.gate(1, path.size()-1, 4); for (int i = 0; i < lookAhead; i++) { int cell = path.get(i); - if (!Dungeon.level.passable[cell] || ( Level.fieldOfView[cell] && Actor.findChar(cell) != null)) { + if (!Dungeon.level.passable[cell] || ( fieldOfView[cell] && Actor.findChar(cell) != null)) { newPath = true; break; } @@ -376,7 +375,7 @@ public abstract class Mob extends Char { if (newPath) { path = Dungeon.findPath(this, pos, target, Dungeon.level.passable, - Level.fieldOfView); + fieldOfView); } //if hunting something, don't follow a path that is extremely inefficient @@ -401,7 +400,7 @@ public abstract class Mob extends Char { protected boolean getFurther( int target ) { int step = Dungeon.flee( this, pos, target, Dungeon.level.passable, - Level.fieldOfView ); + fieldOfView ); if (step != -1) { move( step ); return true; @@ -432,7 +431,7 @@ public abstract class Mob extends Char { protected boolean doAttack( Char enemy ) { - boolean visible = Dungeon.visible[pos]; + boolean visible = Dungeon.level.heroFOV[pos]; if (visible) { sprite.attack( enemy.pos ); @@ -572,7 +571,7 @@ public abstract class Mob extends Char { } } - if (Dungeon.hero.isAlive() && !Dungeon.visible[pos]) { + if (Dungeon.hero.isAlive() && !Dungeon.level.heroFOV[pos]) { GLog.i( Messages.get(this, "died") ); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Piranha.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Piranha.java index a24cac470..efd0a5b58 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Piranha.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Piranha.java @@ -32,7 +32,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Frost; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Paralysis; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Roots; import com.shatteredpixel.shatteredpixeldungeon.items.food.MysteryMeat; -import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.sprites.PiranhaSprite; import com.watabou.utils.Random; @@ -57,13 +56,15 @@ public class Piranha extends Mob { @Override protected boolean act() { + if (!Dungeon.level.water[pos]) { die( null ); sprite.killAndErase(); return true; } else { + //FIXME should handle this is an extended hunting //this causes pirahna to move away when a door is closed on them. - Dungeon.level.updateFieldOfView( this, Level.fieldOfView ); + /*Dungeon.level.updateFieldOfView( this, Level.fieldOfView ); enemy = chooseEnemy(); if (state == this.HUNTING && !(enemy != null && enemy.isAlive() && Level.fieldOfView[enemy.pos] && enemy.invisible <= 0)){ @@ -77,7 +78,7 @@ public class Piranha extends Mob { } while (!getCloser(target)); moveSprite( oldPos, pos ); return true; - } + }*/ return super.act(); } @@ -121,7 +122,7 @@ public class Piranha extends Mob { int step = Dungeon.findStep( this, pos, target, Dungeon.level.water, - Level.fieldOfView ); + fieldOfView ); if (step != -1) { move( step ); return true; @@ -134,7 +135,7 @@ public class Piranha extends Mob { protected boolean getFurther( int target ) { int step = Dungeon.flee( this, pos, target, Dungeon.level.water, - Level.fieldOfView ); + fieldOfView ); if (step != -1) { move( step ); return true; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Shaman.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Shaman.java index f6199c114..eedf87e0d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Shaman.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Shaman.java @@ -25,7 +25,6 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.effects.particles.SparkParticle; import com.shatteredpixel.shatteredpixeldungeon.items.Generator; -import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.levels.traps.LightningTrap; import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; @@ -84,7 +83,7 @@ public class Shaman extends Mob implements Callback { } else { - boolean visible = Level.fieldOfView[pos] || Level.fieldOfView[enemy.pos]; + boolean visible = fieldOfView[pos] || fieldOfView[enemy.pos]; if (visible) { sprite.zap( enemy.pos ); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Skeleton.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Skeleton.java index 4c70409cc..29411c87a 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Skeleton.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Skeleton.java @@ -75,7 +75,7 @@ public class Skeleton extends Mob { } } - if (Dungeon.visible[pos]) { + if (Dungeon.level.heroFOV[pos]) { Sample.INSTANCE.play( Assets.SND_BONES ); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Statue.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Statue.java index 9477b3760..e0dcd9704 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Statue.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Statue.java @@ -79,7 +79,7 @@ public class Statue extends Mob { @Override protected boolean act() { - if (Dungeon.visible[pos]) { + if (Dungeon.level.heroFOV[pos]) { Notes.add( Notes.Landmark.STATUE ); } return super.act(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Succubus.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Succubus.java index fa8f7fd08..2bf937dc3 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Succubus.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Succubus.java @@ -33,7 +33,6 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfLullaby; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Vampiric; -import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; import com.shatteredpixel.shatteredpixeldungeon.sprites.SuccubusSprite; import com.watabou.noosa.audio.Sample; @@ -85,7 +84,7 @@ public class Succubus extends Mob { @Override protected boolean getCloser( int target ) { - if (Level.fieldOfView[target] && Dungeon.level.distance( pos, target ) > 2 && delay <= 0) { + if (fieldOfView[target] && Dungeon.level.distance( pos, target ) > 2 && delay <= 0) { blink( target ); spend( -1 / speed() ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Tengu.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Tengu.java index 47246ecdb..a6c317a21 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Tengu.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Tengu.java @@ -170,7 +170,7 @@ public class Tengu extends Mob { int trapPos; do { trapPos = Random.Int( Dungeon.level.length() ); - } while (!Level.fieldOfView[trapPos] || Dungeon.level.solid[trapPos]); + } while (!fieldOfView[trapPos] || Dungeon.level.solid[trapPos]); if (Dungeon.level.map[trapPos] == Terrain.INACTIVE_TRAP) { Dungeon.level.setTrap( new SpearTrap().reveal(), trapPos ); @@ -201,13 +201,13 @@ public class Tengu extends Mob { Actor.findChar(newPos) != null); } - if (Dungeon.visible[pos]) CellEmitter.get( pos ).burst( Speck.factory( Speck.WOOL ), 6 ); + if (Dungeon.level.heroFOV[pos]) CellEmitter.get( pos ).burst( Speck.factory( Speck.WOOL ), 6 ); sprite.move( pos, newPos ); move( newPos ); - if (Dungeon.visible[newPos]) CellEmitter.get( newPos ).burst( Speck.factory( Speck.WOOL ), 6 ); + if (Dungeon.level.heroFOV[newPos]) CellEmitter.get( newPos ).burst( Speck.factory( Speck.WOOL ), 6 ); Sample.INSTANCE.play( Assets.SND_PUFF ); spend( 1 / speed() ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Thief.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Thief.java index 90aae79af..9feddf413 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Thief.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Thief.java @@ -203,7 +203,7 @@ public class Thief extends Mob { if (enemySeen) { sprite.showStatus(CharSprite.NEGATIVE, Messages.get(Mob.class, "rage")); state = HUNTING; - } else if (item != null && !Dungeon.visible[pos]) { + } else if (item != null && !Dungeon.level.heroFOV[pos]) { int count = 32; int newPos; @@ -212,15 +212,15 @@ public class Thief extends Mob { if (count-- <= 0) { break; } - } while (newPos == -1 || Dungeon.visible[newPos] || Dungeon.level.distance(newPos, pos) < (count/3)); + } while (newPos == -1 || Dungeon.level.heroFOV[newPos] || Dungeon.level.distance(newPos, pos) < (count/3)); if (newPos != -1) { - if (Dungeon.visible[pos]) CellEmitter.get(pos).burst(Speck.factory(Speck.WOOL), 6); + if (Dungeon.level.heroFOV[pos]) CellEmitter.get(pos).burst(Speck.factory(Speck.WOOL), 6); pos = newPos; sprite.place( pos ); - sprite.visible = Dungeon.visible[pos]; - if (Dungeon.visible[pos]) CellEmitter.get(pos).burst(Speck.factory(Speck.WOOL), 6); + sprite.visible = Dungeon.level.heroFOV[pos]; + if (Dungeon.level.heroFOV[pos]) CellEmitter.get(pos).burst(Speck.factory(Speck.WOOL), 6); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Warlock.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Warlock.java index 9bc5d97e6..b2ccb1e76 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Warlock.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Warlock.java @@ -29,7 +29,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Generator; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHealing; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Grim; -import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite; @@ -87,7 +86,7 @@ public class Warlock extends Mob implements Callback { } else { - boolean visible = Level.fieldOfView[pos] || Level.fieldOfView[enemy.pos]; + boolean visible = fieldOfView[pos] || fieldOfView[enemy.pos]; if (visible) { sprite.zap( enemy.pos ); } else { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Ghost.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Ghost.java index 07734c76c..0c9764242 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Ghost.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Ghost.java @@ -144,7 +144,7 @@ public class Ghost extends NPC { CellEmitter.get(pos).start(Speck.factory(Speck.LIGHT), 0.2f, 3); pos = newPos; sprite.place(pos); - sprite.visible = Dungeon.visible[pos]; + sprite.visible = Dungeon.level.heroFOV[pos]; } } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Imp.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Imp.java index 80eca3257..0e94b79df 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Imp.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Imp.java @@ -54,7 +54,7 @@ public class Imp extends NPC { @Override protected boolean act() { - if (!Quest.given && Dungeon.visible[pos]) { + if (!Quest.given && Dungeon.level.heroFOV[pos]) { if (!seenBefore) { yell( Messages.get(this, "hey", Dungeon.hero.givenName() ) ); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/ImpShopkeeper.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/ImpShopkeeper.java index c6501382e..c0f96439a 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/ImpShopkeeper.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/ImpShopkeeper.java @@ -40,7 +40,7 @@ public class ImpShopkeeper extends Shopkeeper { @Override protected boolean act() { - if (!seenBefore && Dungeon.visible[pos]) { + if (!seenBefore && Dungeon.level.heroFOV[pos]) { yell( Messages.get(this, "greetings", Dungeon.hero.givenName() ) ); seenBefore = true; } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/MirrorImage.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/MirrorImage.java index 576e0abd4..eb80526b4 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/MirrorImage.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/MirrorImage.java @@ -28,7 +28,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.VenomGas; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob; -import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.MirrorSprite; import com.watabou.utils.Bundle; @@ -100,7 +99,7 @@ public class MirrorImage extends NPC { HashSet enemies = new HashSet<>(); for (Mob mob : Dungeon.level.mobs) { if (mob.hostile - && Level.fieldOfView[mob.pos] + && fieldOfView[mob.pos] && mob.state != mob.PASSIVE) { enemies.add(mob); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/effects/BlobEmitter.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/effects/BlobEmitter.java index b8cf188ed..01675bda7 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/effects/BlobEmitter.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/effects/BlobEmitter.java @@ -22,8 +22,8 @@ package com.shatteredpixel.shatteredpixeldungeon.effects; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; -import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap; import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob; +import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap; import com.watabou.noosa.particles.Emitter; import com.watabou.utils.Random; @@ -56,7 +56,7 @@ public class BlobEmitter extends Emitter { for (int i = blob.area.left; i < blob.area.right; i++) { for (int j = blob.area.top; j < blob.area.bottom; j++) { cell = i + j*Dungeon.level.width(); - if (map[cell] > 0 && Dungeon.visible[cell]) { + if (map[cell] > 0 && Dungeon.level.heroFOV[cell]) { float x = (i + Random.Float()) * size; float y = (j + Random.Float()) * size; factory.emit(this, index, x, y); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/effects/particles/FlowParticle.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/effects/particles/FlowParticle.java index a1f9e78de..5bcb6c650 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/effects/particles/FlowParticle.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/effects/particles/FlowParticle.java @@ -96,7 +96,7 @@ public class FlowParticle extends PixelParticle { @Override public void update() { - if (visible = Dungeon.visible[pos]) { + if (visible = Dungeon.level.heroFOV[pos]) { super.update(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/effects/particles/WindParticle.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/effects/particles/WindParticle.java index a9c5a87f4..67b2146ff 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/effects/particles/WindParticle.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/effects/particles/WindParticle.java @@ -99,7 +99,7 @@ public class WindParticle extends PixelParticle { @Override public void update() { - if (visible = Dungeon.visible[pos]) { + if (visible = Dungeon.level.heroFOV[pos]) { super.update(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Bomb.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Bomb.java index 5b30ce316..efb1d6f7d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Bomb.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Bomb.java @@ -115,7 +115,7 @@ public class Bomb extends Item { Sample.INSTANCE.play( Assets.SND_BLAST ); - if (Dungeon.visible[cell]) { + if (Dungeon.level.heroFOV[cell]) { CellEmitter.center( cell ).burst( BlastParticle.FACTORY, 30 ); } @@ -123,7 +123,7 @@ public class Bomb extends Item { for (int n : PathFinder.NEIGHBOURS9) { int c = cell + n; if (c >= 0 && c < Dungeon.level.length()) { - if (Dungeon.visible[c]) { + if (Dungeon.level.heroFOV[c]) { CellEmitter.get( c ).burst( SmokeParticle.FACTORY, 4 ); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java index 3ce459fea..a77088788 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java @@ -252,7 +252,7 @@ public class Heap implements Bundlable { if (burnt || evaporated) { - if (Dungeon.visible[pos]) { + if (Dungeon.level.heroFOV[pos]) { if (burnt) { burnFX( pos ); } else { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Honeypot.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Honeypot.java index 9a1f65f7a..106333941 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Honeypot.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Honeypot.java @@ -88,7 +88,7 @@ public class Honeypot extends Item { public Item shatter( Char owner, int pos ) { - if (Dungeon.visible[pos]) { + if (Dungeon.level.heroFOV[pos]) { Sample.INSTANCE.play( Assets.SND_SHATTER ); Splash.at( pos, 0xffd500, 5 ); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/HuntressArmor.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/HuntressArmor.java index 132805bd3..0b550f508 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/HuntressArmor.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/HuntressArmor.java @@ -25,7 +25,6 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Shuriken; -import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.sprites.MissileSprite; @@ -49,7 +48,7 @@ public class HuntressArmor extends ClassArmor { Item proto = new Shuriken(); for (Mob mob : Dungeon.level.mobs) { - if (Level.fieldOfView[mob.pos]) { + if (Dungeon.level.heroFOV[mob.pos]) { Callback callback = new Callback() { @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/MageArmor.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/MageArmor.java index 700bf0f8f..207fc452d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/MageArmor.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/MageArmor.java @@ -29,7 +29,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Roots; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob; import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ElmoParticle; -import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.watabou.noosa.audio.Sample; @@ -43,7 +42,7 @@ public class MageArmor extends ClassArmor { public void doSpecial() { for (Mob mob : Dungeon.level.mobs) { - if (Level.fieldOfView[mob.pos]) { + if (Dungeon.level.heroFOV[mob.pos]) { Buff.affect( mob, Burning.class ).reignite( mob ); Buff.prolong( mob, Roots.class, 3 ); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/RogueArmor.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/RogueArmor.java index a758f71fb..24640b43c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/RogueArmor.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/RogueArmor.java @@ -30,7 +30,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob; import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation; -import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.CellSelector; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; @@ -55,7 +54,7 @@ public class RogueArmor extends ClassArmor { public void onSelect( Integer target ) { if (target != null) { - if (!Level.fieldOfView[target] || + if (!Dungeon.level.heroFOV[target] || !(Dungeon.level.passable[target] || Dungeon.level.avoid[target]) || Actor.findChar( target ) != null) { @@ -66,7 +65,7 @@ public class RogueArmor extends ClassArmor { curUser.HP -= (curUser.HP / 3); for (Mob mob : Dungeon.level.mobs.toArray(new Mob[Dungeon.level.mobs.size()])) { - if (Level.fieldOfView[mob.pos]) { + if (Dungeon.level.heroFOV[mob.pos]) { Buff.prolong( mob, Blindness.class, 2 ); if (mob.state == mob.HUNTING) mob.state = mob.WANDERING; mob.sprite.emitter().burst( Speck.factory( Speck.LIGHT ), 4 ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java index 47bb4f9f1..ccfdd9246 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java @@ -475,7 +475,7 @@ public class DriedRose extends Artifact { HashSet enemies = new HashSet<>(); for (Mob mob : Dungeon.level.mobs) { if (mob.hostile - && Level.fieldOfView[mob.pos] + && fieldOfView[mob.pos] && Dungeon.level.distance(mob.pos, Dungeon.hero.pos) <= 8 && mob.state != mob.PASSIVE) { enemies.add(mob); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/LloydsBeacon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/LloydsBeacon.java index 9643f8ee4..768b61b9a 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/LloydsBeacon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/LloydsBeacon.java @@ -233,7 +233,7 @@ public class LloydsBeacon extends Artifact { ch.pos = pos; ch.sprite.place(ch.pos); - ch.sprite.visible = Dungeon.visible[pos]; + ch.sprite.visible = Dungeon.level.heroFOV[pos]; } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TalismanOfForesight.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TalismanOfForesight.java index daf0fd7a0..dc5a78692 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TalismanOfForesight.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TalismanOfForesight.java @@ -82,7 +82,7 @@ public class TalismanOfForesight extends Artifact { GameScene.updateMap(i); - if (Dungeon.visible[i]) { + if (Dungeon.level.heroFOV[i]) { GameScene.discoverTile(i, terr); } } @@ -152,7 +152,7 @@ public class TalismanOfForesight extends Artifact { for (int y = ay; y <= by; y++) { for (int x = ax, p = ax + y * Dungeon.level.width(); x <= bx; x++, p++) { - if (Dungeon.visible[p] + if (Dungeon.level.heroFOV[p] && Dungeon.level.secret[p] && Dungeon.level.map[p] != Terrain.SECRET_DOOR) smthFound = true; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/Potion.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/Potion.java index 4a7cc786f..c781fcb76 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/Potion.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/Potion.java @@ -231,7 +231,7 @@ public class Potion extends Item { } public void shatter( int cell ) { - if (Dungeon.visible[cell]) { + if (Dungeon.level.heroFOV[cell]) { GLog.i( Messages.get(Potion.class, "shatter") ); Sample.INSTANCE.play( Assets.SND_SHATTER ); splash( cell ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfLevitation.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfLevitation.java index 5f0788cb8..8b0906ebe 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfLevitation.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfLevitation.java @@ -42,7 +42,7 @@ public class PotionOfLevitation extends Potion { @Override public void shatter( int cell ) { - if (Dungeon.visible[cell]) { + if (Dungeon.level.heroFOV[cell]) { setKnown(); splash( cell ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfLiquidFlame.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfLiquidFlame.java index ef832cc1a..808d4c8cc 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfLiquidFlame.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfLiquidFlame.java @@ -41,7 +41,7 @@ public class PotionOfLiquidFlame extends Potion { @Override public void shatter( int cell ) { - if (Dungeon.visible[cell]) { + if (Dungeon.level.heroFOV[cell]) { setKnown(); splash( cell ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfParalyticGas.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfParalyticGas.java index ffac51745..072154155 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfParalyticGas.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfParalyticGas.java @@ -37,7 +37,7 @@ public class PotionOfParalyticGas extends Potion { @Override public void shatter( int cell ) { - if (Dungeon.visible[cell]) { + if (Dungeon.level.heroFOV[cell]) { setKnown(); splash( cell ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfPurity.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfPurity.java index 5b7753e2b..c0e71e35d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfPurity.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfPurity.java @@ -80,7 +80,7 @@ public class PotionOfPurity extends Potion { blob.volume -= value; procd = true; - if (Dungeon.visible[i]) { + if (Dungeon.level.heroFOV[i]) { CellEmitter.get( i ).burst( Speck.factory( Speck.DISCOVER ), 1 ); } } @@ -93,7 +93,7 @@ public class PotionOfPurity extends Potion { if (procd) { - if (Dungeon.visible[cell]) { + if (Dungeon.level.heroFOV[cell]) { splash( cell ); Sample.INSTANCE.play( Assets.SND_SHATTER ); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfToxicGas.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfToxicGas.java index 3d6d9c31c..b7212fa82 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfToxicGas.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfToxicGas.java @@ -37,7 +37,7 @@ public class PotionOfToxicGas extends Potion { @Override public void shatter( int cell ) { - if (Dungeon.visible[cell]) { + if (Dungeon.level.heroFOV[cell]) { setKnown(); splash( cell ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/quest/CorpseDust.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/quest/CorpseDust.java index d1afbeee8..b6a49a6ac 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/quest/CorpseDust.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/quest/CorpseDust.java @@ -103,7 +103,7 @@ public class CorpseDust extends Item { int pos = 0; do{ pos = Random.Int(Dungeon.level.length()); - } while (!Dungeon.visible[pos] || !Dungeon.level.passable[pos] || Actor.findChar( pos ) != null); + } while (!Dungeon.level.heroFOV[pos] || !Dungeon.level.passable[pos] || Actor.findChar( pos ) != null); Wraith.spawnAt(pos); Sample.INSTANCE.play(Assets.SND_CURSED); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfLullaby.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfLullaby.java index b0bdc8481..80a06aa00 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfLullaby.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfLullaby.java @@ -28,7 +28,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Drowsy; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; -import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.watabou.noosa.audio.Sample; @@ -47,7 +46,7 @@ public class ScrollOfLullaby extends Scroll { Invisibility.dispel(); for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) { - if (Level.fieldOfView[mob.pos]) { + if (Dungeon.level.heroFOV[mob.pos]) { Buff.affect( mob, Drowsy.class ); mob.sprite.centerEmitter().start( Speck.factory( Speck.NOTE ), 0.3f, 5 ); } @@ -66,7 +65,7 @@ public class ScrollOfLullaby extends Scroll { public void empoweredRead() { doRead(); for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) { - if (Level.fieldOfView[mob.pos]) { + if (Dungeon.level.heroFOV[mob.pos]) { Buff drowsy = mob.buff(Drowsy.class); if (drowsy != null) drowsy.act(); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfMagicMapping.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfMagicMapping.java index ec651d44a..1e1e6040e 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfMagicMapping.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfMagicMapping.java @@ -63,7 +63,7 @@ public class ScrollOfMagicMapping extends Scroll { Dungeon.level.discover( i ); - if (Dungeon.visible[i]) { + if (Dungeon.level.heroFOV[i]) { GameScene.discoverTile( i, terr ); discover( i ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfPsionicBlast.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfPsionicBlast.java index 526621274..fcb7e01d5 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfPsionicBlast.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfPsionicBlast.java @@ -28,7 +28,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Paralysis; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob; -import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; @@ -52,7 +51,7 @@ public class ScrollOfPsionicBlast extends Scroll { Invisibility.dispel(); for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) { - if (Level.fieldOfView[mob.pos]) { + if (Dungeon.level.heroFOV[mob.pos]) { mob.damage(mob.HT, this ); } } @@ -80,7 +79,7 @@ public class ScrollOfPsionicBlast extends Scroll { Invisibility.dispel(); for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) { - if (Level.fieldOfView[mob.pos]) { + if (Dungeon.level.heroFOV[mob.pos]) { mob.damage(mob.HT, this ); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfRage.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfRage.java index c3d71a3c7..394bcc55c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfRage.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfRage.java @@ -30,7 +30,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mimic; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.items.Heap; -import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.watabou.noosa.audio.Sample; @@ -46,7 +45,7 @@ public class ScrollOfRage extends Scroll { for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) { mob.beckon( curUser.pos ); - if (Level.fieldOfView[mob.pos]) { + if (Dungeon.level.heroFOV[mob.pos]) { Buff.prolong(mob, Amok.class, 5f); } } @@ -74,7 +73,7 @@ public class ScrollOfRage extends Scroll { @Override public void empoweredRead() { for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) { - if (Level.fieldOfView[mob.pos]) { + if (Dungeon.level.heroFOV[mob.pos]) { Buff.prolong(mob, Amok.class, 5f); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfTerror.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfTerror.java index c8cbd68c8..72efc6070 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfTerror.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfTerror.java @@ -29,7 +29,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Paralysis; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Terror; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob; import com.shatteredpixel.shatteredpixeldungeon.effects.Flare; -import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.watabou.noosa.audio.Sample; @@ -50,7 +49,7 @@ public class ScrollOfTerror extends Scroll { int count = 0; Mob affected = null; for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) { - if (Level.fieldOfView[mob.pos]) { + if (Dungeon.level.heroFOV[mob.pos]) { Buff.affect( mob, Terror.class, Terror.DURATION ).object = curUser.id(); if (mob.buff(Terror.class) != null){ @@ -79,7 +78,7 @@ public class ScrollOfTerror extends Scroll { public void empoweredRead() { doRead(); for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) { - if (Level.fieldOfView[mob.pos]) { + if (Dungeon.level.heroFOV[mob.pos]) { Terror t = mob.buff(Terror.class); if (t != null){ Buff.prolong(mob, Terror.class, Terror.DURATION*1.5f); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/CursedWand.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/CursedWand.java index 5edffef92..2692e94e9 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/CursedWand.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/CursedWand.java @@ -166,7 +166,7 @@ public class CursedWand { } else { ch.pos = pos; ch.sprite.place(ch.pos); - ch.sprite.visible = Dungeon.visible[pos]; + ch.sprite.visible = Dungeon.level.heroFOV[pos]; } } wand.wandUsed(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/Displacing.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/Displacing.java index 9d12aad6f..b1b0bcae2 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/Displacing.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/Displacing.java @@ -48,13 +48,13 @@ public class Displacing extends Weapon.Enchantment { if (newPos != -1 && !Dungeon.bossLevel()) { - if (Dungeon.visible[defender.pos]) { + if (Dungeon.level.heroFOV[defender.pos]) { CellEmitter.get( defender.pos ).start( Speck.factory( Speck.LIGHT ), 0.2f, 3 ); } defender.pos = newPos; defender.sprite.place( defender.pos ); - defender.sprite.visible = Dungeon.visible[defender.pos]; + defender.sprite.visible = Dungeon.level.heroFOV[defender.pos]; return 0; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/CavesBossLevel.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/CavesBossLevel.java index da8045695..26bdd3b12 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/CavesBossLevel.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/CavesBossLevel.java @@ -241,7 +241,7 @@ public class CavesBossLevel extends Level { } while ( !passable[boss.pos] || !outsideEntraceRoom( boss.pos ) || - Dungeon.visible[boss.pos]); + heroFOV[boss.pos]); GameScene.add( boss ); set( arenaDoor, Terrain.WALL ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/CavesLevel.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/CavesLevel.java index d1d235c9c..59deeac10 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/CavesLevel.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/CavesLevel.java @@ -180,7 +180,7 @@ public class CavesLevel extends RegularLevel { @Override public void update() { - if (visible = Dungeon.visible[pos]) { + if (visible = Dungeon.level.heroFOV[pos]) { super.update(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/CityBossLevel.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/CityBossLevel.java index 0da456b56..f71979be7 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/CityBossLevel.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/CityBossLevel.java @@ -213,10 +213,10 @@ public class CityBossLevel extends Level { } while ( !passable[boss.pos] || !outsideEntraceRoom( boss.pos ) || - (Dungeon.visible[boss.pos] && count++ < 20)); + (heroFOV[boss.pos] && count++ < 20)); GameScene.add( boss ); - if (Dungeon.visible[boss.pos]) { + if (heroFOV[boss.pos]) { boss.notice(); boss.sprite.alpha( 0 ); boss.sprite.parent.add( new AlphaTweener( boss.sprite, 1, 0.1f ) ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/CityLevel.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/CityLevel.java index 3c33fcd4b..6c48df514 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/CityLevel.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/CityLevel.java @@ -187,7 +187,7 @@ public class CityLevel extends RegularLevel { @Override public void update() { - if (visible = Dungeon.visible[pos]) { + if (visible = Dungeon.level.heroFOV[pos]) { super.update(); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/HallsBossLevel.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/HallsBossLevel.java index 4304fe608..2e342f423 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/HallsBossLevel.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/HallsBossLevel.java @@ -205,7 +205,7 @@ public class HallsBossLevel extends Level { boss.pos = Random.Int( length() ); } while ( !passable[boss.pos] || - Dungeon.visible[boss.pos]); + heroFOV[boss.pos]); GameScene.add( boss ); boss.spawnFists(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/HallsLevel.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/HallsLevel.java index c945a3e9c..8b389a3e1 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/HallsLevel.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/HallsLevel.java @@ -183,7 +183,7 @@ public class HallsLevel extends RegularLevel { @Override public void update() { - if (visible = Dungeon.visible[pos]) { + if (visible = Dungeon.level.heroFOV[pos]) { super.update(); 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 3de588058..3af0d525e 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java @@ -116,9 +116,8 @@ public abstract class Level implements Bundlable { public boolean[] discoverable; public int viewDistance = Dungeon.isChallenged( Challenges.DARKNESS ) ? 4 : 8; - - //TODO even though it would cost more memory, it may make more sense to have this be a property of char. - public static boolean[] fieldOfView; + + public boolean[] heroFOV; public boolean[] passable; public boolean[] losBlocking; @@ -255,22 +254,21 @@ public abstract class Level implements Bundlable { length = w * h; map = new int[length]; - Arrays.fill( map, Terrain.WALL ); Arrays.fill( map, feeling == Level.Feeling.CHASM ? Terrain.CHASM : Terrain.WALL ); - visited = new boolean[length]; - mapped = new boolean[length]; + visited = new boolean[length]; + mapped = new boolean[length]; - fieldOfView = new boolean[length()]; + heroFOV = new boolean[length]; - passable = new boolean[length()]; - losBlocking = new boolean[length()]; - flamable = new boolean[length()]; - secret = new boolean[length()]; - solid = new boolean[length()]; - avoid = new boolean[length()]; - water = new boolean[length()]; - pit = new boolean[length()]; + passable = new boolean[length]; + losBlocking = new boolean[length]; + flamable = new boolean[length]; + secret = new boolean[length]; + solid = new boolean[length]; + avoid = new boolean[length]; + water = new boolean[length]; + pit = new boolean[length]; PathFinder.setMapSize(w, h); } @@ -530,7 +528,7 @@ public abstract class Level implements Bundlable { int cell; do { cell = Random.Int( length() ); - } while ((Dungeon.level == this && Dungeon.visible[cell]) + } while ((Dungeon.level == this && heroFOV[cell]) || !passable[cell] || Actor.findChar( cell ) != null); return cell; @@ -677,7 +675,7 @@ public abstract class Level implements Bundlable { if (heap == null) { heap = new Heap(); - heap.seen = Dungeon.level == this && Dungeon.visible[cell]; + heap.seen = Dungeon.level == this && heroFOV[cell]; heap.pos = cell; if (map[cell] == Terrain.CHASM || (Dungeon.level != null && pit[cell])) { Dungeon.dropToChasm( item ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/PrisonLevel.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/PrisonLevel.java index 447e98b50..18584b0dd 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/PrisonLevel.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/PrisonLevel.java @@ -165,7 +165,7 @@ public class PrisonLevel extends RegularLevel { @Override public void update() { - if (visible = Dungeon.visible[pos]) { + if (visible = Dungeon.level.heroFOV[pos]) { super.update(); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/RegularLevel.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/RegularLevel.java index b1bcf6971..741828c1c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/RegularLevel.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/RegularLevel.java @@ -259,7 +259,7 @@ public abstract class RegularLevel extends Level { } cell = pointToCell(room.random(1)); - if ((Dungeon.level != this || !Dungeon.visible[cell]) + if (!heroFOV[cell] && Actor.findChar( cell ) == null && passable[cell] && cell != exit) { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/SewerLevel.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/SewerLevel.java index d270d73ca..98a98147c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/SewerLevel.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/SewerLevel.java @@ -178,7 +178,7 @@ public class SewerLevel extends RegularLevel { @Override public void update() { - if (visible = Dungeon.visible[pos]) { + if (visible = Dungeon.level.heroFOV[pos]) { super.update(); 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 2116d7abb..1c2c084af 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 @@ -34,7 +34,7 @@ public class Door { Level.set( pos, Terrain.OPEN_DOOR ); GameScene.updateMap( pos ); - if (Dungeon.visible[pos]) { + if (Dungeon.level.heroFOV[pos]) { Dungeon.observe(); Sample.INSTANCE.play( Assets.SND_OPEN ); } @@ -44,7 +44,7 @@ public class Door { if (Dungeon.level.heaps.get( pos ) == null) { Level.set( pos, Terrain.DOOR ); GameScene.updateMap( pos ); - if (Dungeon.visible[pos]) + if (Dungeon.level.heroFOV[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 452cb3c8e..699a4576b 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 @@ -104,7 +104,6 @@ public class HighGrass { } CellEmitter.get( pos ).burst( LeafParticle.LEVEL_SPECIFIC, leaves ); - if (Dungeon.visible[pos]) - Dungeon.observe(); + if (Dungeon.level.heroFOV[pos]) Dungeon.observe(); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/AlarmTrap.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/AlarmTrap.java index 5238ec55b..59aca4084 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/AlarmTrap.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/AlarmTrap.java @@ -44,7 +44,7 @@ public class AlarmTrap extends Trap { mob.beckon( pos ); } - if (Dungeon.visible[pos]) { + if (Dungeon.level.heroFOV[pos]) { GLog.w( Messages.get(this, "alarm") ); CellEmitter.center( pos ).start( Speck.factory( Speck.SCREAM ), 0.3f, 3 ); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/ChillingTrap.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/ChillingTrap.java index a593f563e..7798bc756 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/ChillingTrap.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/ChillingTrap.java @@ -42,7 +42,7 @@ public class ChillingTrap extends Trap{ @Override public void activate() { - if (Dungeon.visible[ pos ]){ + if (Dungeon.level.heroFOV[ pos ]){ Splash.at( pos, 0xFFB2D6FF, 5); Sample.INSTANCE.play( Assets.SND_SHATTER ); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/CursingTrap.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/CursingTrap.java index 7c12131d5..c713a759f 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/CursingTrap.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/CursingTrap.java @@ -53,7 +53,7 @@ public class CursingTrap extends Trap { @Override public void activate() { - if (Dungeon.visible[ pos ]) { + if (Dungeon.level.heroFOV[ pos ]) { CellEmitter.get(pos).burst(ShadowParticle.UP, 5); Sample.INSTANCE.play(Assets.SND_CURSED); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/DisintegrationTrap.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/DisintegrationTrap.java index 13ef9a967..3687972f8 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/DisintegrationTrap.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/DisintegrationTrap.java @@ -23,7 +23,6 @@ package com.shatteredpixel.shatteredpixeldungeon.levels.traps; import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; -import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap; import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; @@ -33,6 +32,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Heap; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; +import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.watabou.noosa.audio.Sample; import com.watabou.utils.Random; @@ -47,7 +47,7 @@ public class DisintegrationTrap extends Trap { @Override public void activate() { - if (Dungeon.visible[ pos ]) { + if (Dungeon.level.heroFOV[ pos ]) { ShatteredPixelDungeon.scene().add( new Beam.DeathRay( DungeonTilemap.tileCenterToWorld(pos-1), DungeonTilemap.tileCenterToWorld(pos+1))); ShatteredPixelDungeon.scene().add(new Beam.DeathRay(DungeonTilemap.tileCenterToWorld(pos - Dungeon.level.width()), diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/FlashingTrap.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/FlashingTrap.java index ad994bde4..1cba5ed4d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/FlashingTrap.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/FlashingTrap.java @@ -59,7 +59,7 @@ public class FlashingTrap extends Trap { } } - if (Dungeon.visible[pos]) { + if (Dungeon.level.heroFOV[pos]) { GameScene.flash(0xFFFFFF); CellEmitter.get(pos).burst( Speck.factory(Speck.LIGHT), 4 ); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/FrostTrap.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/FrostTrap.java index f3058963d..3047eb40a 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/FrostTrap.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/FrostTrap.java @@ -44,7 +44,7 @@ public class FrostTrap extends Trap { @Override public void activate() { - if (Dungeon.visible[ pos ]){ + if (Dungeon.level.heroFOV[ pos ]){ Splash.at( pos, 0xFFB2D6FF, 10); Sample.INSTANCE.play( Assets.SND_SHATTER ); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/GuardianTrap.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/GuardianTrap.java index a90d30722..4393f226b 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/GuardianTrap.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/GuardianTrap.java @@ -47,7 +47,7 @@ public class GuardianTrap extends Trap { mob.beckon( pos ); } - if (Dungeon.visible[pos]) { + if (Dungeon.level.heroFOV[pos]) { GLog.w( Messages.get(this, "alarm") ); CellEmitter.center(pos).start( Speck.factory(Speck.SCREAM), 0.3f, 3 ); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/RockfallTrap.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/RockfallTrap.java index c487ed6a2..2e37f9cdd 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/RockfallTrap.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/RockfallTrap.java @@ -53,7 +53,7 @@ public class RockfallTrap extends Trap { if (Dungeon.level.solid[pos+i]) continue; - if (Dungeon.visible[ pos+i ]){ + if (Dungeon.level.heroFOV[ pos+i ]){ CellEmitter.get( pos + i - Dungeon.level.width() ).start(Speck.factory(Speck.ROCK), 0.07f, 10); if (!seen) { Camera.main.shake(3, 0.7f); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/SpearTrap.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/SpearTrap.java index b75605648..163b60238 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/SpearTrap.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/SpearTrap.java @@ -42,7 +42,7 @@ public class SpearTrap extends Trap { @Override public void trigger() { - if (Dungeon.visible[pos]){ + if (Dungeon.level.heroFOV[pos]){ Sample.INSTANCE.play(Assets.SND_TRAP); } //this trap is not disarmed by being triggered @@ -53,7 +53,7 @@ public class SpearTrap extends Trap { @Override public void activate() { - if (Dungeon.visible[pos]){ + if (Dungeon.level.heroFOV[pos]){ Sample.INSTANCE.play(Assets.SND_HIT); Wound.hit(pos); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/TeleportationTrap.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/TeleportationTrap.java index bb75aeee7..2e9990c7a 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/TeleportationTrap.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/TeleportationTrap.java @@ -69,7 +69,7 @@ public class TeleportationTrap extends Trap { ch.pos = pos; ch.sprite.place(ch.pos); - ch.sprite.visible = Dungeon.visible[pos]; + ch.sprite.visible = Dungeon.level.heroFOV[pos]; } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/Trap.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/Trap.java index 558c3ddc2..8450b6e7b 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/Trap.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/Trap.java @@ -80,7 +80,7 @@ public abstract class Trap implements Bundlable { public void trigger() { if (active) { - if (Dungeon.visible[pos]) { + if (Dungeon.level.heroFOV[pos]) { Sample.INSTANCE.play(Assets.SND_TRAP); } disarm(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/WeakeningTrap.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/WeakeningTrap.java index 3cd5497ec..261155892 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/WeakeningTrap.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/traps/WeakeningTrap.java @@ -39,7 +39,7 @@ public class WeakeningTrap extends Trap{ @Override public void activate() { - if (Dungeon.visible[ pos ]){ + if (Dungeon.level.heroFOV[ pos ]){ CellEmitter.get(pos).burst(ShadowParticle.UP, 5); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Blindweed.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Blindweed.java index 617799260..792de54c7 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Blindweed.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Blindweed.java @@ -54,7 +54,7 @@ public class Blindweed extends Plant { } } - if (Dungeon.visible[pos]) { + if (Dungeon.level.heroFOV[pos]) { CellEmitter.get( pos ).burst( Speck.factory( Speck.LIGHT ), 4 ); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Earthroot.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Earthroot.java index 3b66e5616..22e925ef0 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Earthroot.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Earthroot.java @@ -48,7 +48,7 @@ public class Earthroot extends Plant { Buff.affect( ch, Armor.class ).level(ch.HT); } - if (Dungeon.visible[pos]) { + if (Dungeon.level.heroFOV[pos]) { CellEmitter.bottom( pos ).start( EarthParticle.FACTORY, 0.05f, 8 ); Camera.main.shake( 1, 0.4f ); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Fadeleaf.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Fadeleaf.java index 8e4c439e1..92895da96 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Fadeleaf.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Fadeleaf.java @@ -62,13 +62,13 @@ public class Fadeleaf extends Plant { ch.pos = newPos; ch.sprite.place( ch.pos ); - ch.sprite.visible = Dungeon.visible[ch.pos]; + ch.sprite.visible = Dungeon.level.heroFOV[ch.pos]; } } - if (Dungeon.visible[pos]) { + if (Dungeon.level.heroFOV[pos]) { CellEmitter.get( pos ).start( Speck.factory( Speck.LIGHT ), 0.2f, 3 ); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Firebloom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Firebloom.java index 377c34011..98de95f81 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Firebloom.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Firebloom.java @@ -41,7 +41,7 @@ public class Firebloom extends Plant { GameScene.add( Blob.seed( pos, 2, Fire.class ) ); - if (Dungeon.visible[pos]) { + if (Dungeon.level.heroFOV[pos]) { CellEmitter.get( pos ).burst( FlameParticle.FACTORY, 5 ); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Plant.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Plant.java index 6fd3a92f6..9e4e2ed64 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Plant.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Plant.java @@ -72,7 +72,7 @@ public abstract class Plant implements Bundlable { public void wither() { Dungeon.level.uproot( pos ); - if (Dungeon.visible[pos]) { + if (Dungeon.level.heroFOV[pos]) { CellEmitter.get( pos ).burst( LeafParticle.GENERAL, 6 ); } @@ -168,7 +168,7 @@ public abstract class Plant implements Bundlable { public Plant couch( int pos ) { try { - if (Dungeon.visible != null && Dungeon.visible[pos]) { + if (Dungeon.level.heroFOV != null && Dungeon.level.heroFOV[pos]) { Sample.INSTANCE.play(Assets.SND_PLANT); } Plant plant = plantClass.newInstance(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Sorrowmoss.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Sorrowmoss.java index e66e84de2..5174e491c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Sorrowmoss.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Sorrowmoss.java @@ -45,7 +45,7 @@ public class Sorrowmoss extends Plant { Buff.affect( ch, Poison.class ).set( Poison.durationFactor( ch ) * (4 + Dungeon.depth / 2) ); } - if (Dungeon.visible[pos]) { + if (Dungeon.level.heroFOV[pos]) { CellEmitter.center( pos ).burst( PoisonParticle.SPLASH, 3 ); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Sungrass.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Sungrass.java index 1efa057c7..cfb3297cd 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Sungrass.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/plants/Sungrass.java @@ -49,7 +49,7 @@ public class Sungrass extends Plant { Buff.affect( ch, Health.class ).boost(ch.HT); } - if (Dungeon.visible[pos]) { + if (Dungeon.level.heroFOV[pos]) { CellEmitter.get( pos ).start( ShaftParticle.FACTORY, 0.2f, 3 ); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java index 714f5901a..cc809ee03 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java @@ -617,7 +617,7 @@ public class GameScene extends PixelScene { private void addMobSprite( Mob mob ) { CharSprite sprite = mob.sprite(); - sprite.visible = Dungeon.visible[mob.pos]; + sprite.visible = Dungeon.level.heroFOV[mob.pos]; mobs.add( sprite ); sprite.link( mob ); } @@ -832,7 +832,7 @@ public class GameScene extends PixelScene { if (scene != null) { for (Mob mob : Dungeon.level.mobs) { if (mob.sprite != null) - mob.sprite.visible = Dungeon.visible[mob.pos]; + mob.sprite.visible = Dungeon.level.heroFOV[mob.pos]; } } } @@ -932,7 +932,7 @@ public class GameScene extends PixelScene { objects.add(Dungeon.hero); names.add(Dungeon.hero.className().toUpperCase(Locale.ENGLISH)); } else { - if (Dungeon.visible[cell]) { + if (Dungeon.level.heroFOV[cell]) { Mob mob = (Mob) Actor.findChar(cell); if (mob != null) { objects.add(mob); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/InterlevelScene.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/InterlevelScene.java index 11b000ac9..374c92aaa 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/InterlevelScene.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/InterlevelScene.java @@ -84,8 +84,6 @@ public class InterlevelScene extends PixelScene { phase = Phase.FADE_IN; timeLeft = TIME_TO_FADE; - - Dungeon.visible = null; thread = new Thread() { @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/SkeletonSprite.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/SkeletonSprite.java index f5b56c120..9e9f6b84f 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/SkeletonSprite.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/SkeletonSprite.java @@ -53,7 +53,7 @@ public class SkeletonSprite extends MobSprite { @Override public void die() { super.die(); - if (Dungeon.visible[ch.pos]) { + if (Dungeon.level.heroFOV[ch.pos]) { emitter().burst( Speck.factory( Speck.BONE ), 6 ); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/UndeadSprite.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/UndeadSprite.java index 90e074b8f..7af26e0f1 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/UndeadSprite.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/UndeadSprite.java @@ -53,7 +53,7 @@ public class UndeadSprite extends MobSprite { @Override public void die() { super.die(); - if (Dungeon.visible[ch.pos]) { + if (Dungeon.level.heroFOV[ch.pos]) { emitter().burst( Speck.factory( Speck.BONE ), 3 ); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/tiles/FogOfWar.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/tiles/FogOfWar.java index 1ba1db355..a527fc534 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/tiles/FogOfWar.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/tiles/FogOfWar.java @@ -357,7 +357,7 @@ public class FogOfWar extends Image { public void draw() { if (!updated.isEmpty()){ - updateTexture(Dungeon.visible, Dungeon.level.visited, Dungeon.level.mapped); + updateTexture(Dungeon.level.heroFOV, Dungeon.level.visited, Dungeon.level.mapped); updating.setEmpty(); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/QuickSlotButton.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/QuickSlotButton.java index 392923341..61c53705b 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/QuickSlotButton.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/QuickSlotButton.java @@ -173,7 +173,7 @@ public class QuickSlotButton extends Button implements WndBag.Listener { if (lastTarget != null && Actor.chars().contains( lastTarget ) && lastTarget.isAlive() && - Dungeon.visible[lastTarget.pos]) { + Dungeon.level.heroFOV[lastTarget.pos]) { targeting = true; CharSprite sprite = lastTarget.sprite;