v0.6.2b: fixed bugs and added several safety checks
This commit is contained in:
committed by
Evan Debenham
parent
38e712cc50
commit
4ee449c918
@@ -44,7 +44,7 @@ public enum Music implements MediaPlayer.OnPreparedListener, MediaPlayer.OnError
|
|||||||
|
|
||||||
public void play( String assetName, boolean looping ) {
|
public void play( String assetName, boolean looping ) {
|
||||||
|
|
||||||
if (isPlaying() && lastPlayed.equals( assetName )) {
|
if (isPlaying() && lastPlayed != null && lastPlayed.equals( assetName )) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -165,6 +165,13 @@ public class Tengu extends Mob {
|
|||||||
private void jump() {
|
private void jump() {
|
||||||
|
|
||||||
Level level = Dungeon.level;
|
Level level = Dungeon.level;
|
||||||
|
|
||||||
|
//incase tengu hasn't had a chance to act yet
|
||||||
|
if (fieldOfView == null || fieldOfView.length != Dungeon.level.length()){
|
||||||
|
fieldOfView = new boolean[Dungeon.level.length()];
|
||||||
|
Dungeon.level.updateFieldOfView( this, fieldOfView );
|
||||||
|
}
|
||||||
|
|
||||||
if (enemy == null) enemy = chooseEnemy();
|
if (enemy == null) enemy = chooseEnemy();
|
||||||
if (enemy == null) return;
|
if (enemy == null) return;
|
||||||
|
|
||||||
|
|||||||
+3
-1
@@ -56,7 +56,9 @@ public class BlobEmitter extends Emitter {
|
|||||||
for (int i = blob.area.left; i < blob.area.right; i++) {
|
for (int i = blob.area.left; i < blob.area.right; i++) {
|
||||||
for (int j = blob.area.top; j < blob.area.bottom; j++) {
|
for (int j = blob.area.top; j < blob.area.bottom; j++) {
|
||||||
cell = i + j*Dungeon.level.width();
|
cell = i + j*Dungeon.level.width();
|
||||||
if (map[cell] > 0 && Dungeon.level.heroFOV[cell]) {
|
if (map[cell] > 0
|
||||||
|
&& cell < Dungeon.level.heroFOV.length
|
||||||
|
&& Dungeon.level.heroFOV[cell]) {
|
||||||
float x = (i + Random.Float()) * size;
|
float x = (i + Random.Float()) * size;
|
||||||
float y = (j + Random.Float()) * size;
|
float y = (j + Random.Float()) * size;
|
||||||
factory.emit(this, index, x, y);
|
factory.emit(this, index, x, y);
|
||||||
|
|||||||
+1
-1
@@ -96,7 +96,7 @@ public class FlowParticle extends PixelParticle {
|
|||||||
@Override
|
@Override
|
||||||
public void update() {
|
public void update() {
|
||||||
|
|
||||||
if (visible = Dungeon.level.heroFOV[pos]) {
|
if (visible = (pos < Dungeon.level.heroFOV.length && Dungeon.level.heroFOV[pos])) {
|
||||||
|
|
||||||
super.update();
|
super.update();
|
||||||
|
|
||||||
|
|||||||
@@ -902,7 +902,7 @@ public class GameScene extends PixelScene {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static boolean cancel() {
|
static boolean cancel() {
|
||||||
if (Dungeon.hero.curAction != null || Dungeon.hero.resting) {
|
if (Dungeon.hero != null || Dungeon.hero.curAction != null || Dungeon.hero.resting) {
|
||||||
|
|
||||||
Dungeon.hero.curAction = null;
|
Dungeon.hero.curAction = null;
|
||||||
Dungeon.hero.resting = false;
|
Dungeon.hero.resting = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user