diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/effects/BannerSprites.java b/src/com/shatteredpixel/shatteredpixeldungeon/effects/BannerSprites.java
index 666e10dd9..149b326bf 100644
--- a/src/com/shatteredpixel/shatteredpixeldungeon/effects/BannerSprites.java
+++ b/src/com/shatteredpixel/shatteredpixeldungeon/effects/BannerSprites.java
@@ -26,7 +26,8 @@ public class BannerSprites {
PIXEL_DUNGEON,
BOSS_SLAIN,
GAME_OVER,
- SELECT_YOUR_HERO
+ SELECT_YOUR_HERO,
+ PIXEL_DUNGEON_SIGNS
};
public static Image get( Type type ) {
@@ -44,6 +45,9 @@ public class BannerSprites {
case SELECT_YOUR_HERO:
icon.frame( icon.texture.uvRect( 0, 140, 128, 161 ) );
break;
+ case PIXEL_DUNGEON_SIGNS:
+ icon.frame( icon.texture.uvRect( 0, 161, 128, 218 ) );
+ break;
}
return icon;
}
diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/effects/Degradation.java b/src/com/shatteredpixel/shatteredpixeldungeon/effects/Degradation.java
new file mode 100644
index 000000000..0d1c04cbb
--- /dev/null
+++ b/src/com/shatteredpixel/shatteredpixeldungeon/effects/Degradation.java
@@ -0,0 +1,156 @@
+/*
+ * Pixel Dungeon
+ * Copyright (C) 2012-2015 Oleg Dolya
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see
+ */
+package com.shatteredpixel.shatteredpixeldungeon.effects;
+
+import javax.microedition.khronos.opengles.GL10;
+
+import android.opengl.GLES20;
+
+import com.watabou.noosa.Group;
+import com.watabou.noosa.particles.PixelParticle;
+import com.watabou.utils.PointF;
+import com.watabou.utils.Random;
+
+public class Degradation extends Group {
+
+ private static int[] WEAPON = {
+ +2, -2,
+ +1, -1,
+ 0, 0,
+ -1, +1,
+ -2, +2,
+ -2, 0,
+ 0, +2
+ };
+
+ private static int[] ARMOR = {
+ -2, -1,
+ -1, -1,
+ +1, -1,
+ +2, -1,
+ -2, 0,
+ -1, 0,
+ 0, 0,
+ +1, 0,
+ +2, 0,
+ -1, +1,
+ +1, +1,
+ -1, +2,
+ 0, +2,
+ +1, +2
+ };
+
+ private static int[] RING = {
+ 0, -1,
+ -1, 0,
+ 0, 0,
+ +1, 0,
+ -1, +1,
+ +1, +1,
+ -1, +2,
+ 0, +2,
+ +1, +2
+ };
+
+ private static int[] WAND = {
+ +2, -2,
+ +1, -1,
+ 0, 0,
+ -1, +1,
+ -2, +2,
+ +1, -2,
+ +2, -1
+ };
+
+ public static Degradation weapon( PointF p ) {
+ return new Degradation( p, WEAPON );
+ }
+
+ public static Degradation armor( PointF p ) {
+ return new Degradation( p, ARMOR );
+ }
+
+ public static Degradation ring( PointF p ) {
+ return new Degradation( p, RING );
+ }
+
+ public static Degradation wand( PointF p ) {
+ return new Degradation( p, WAND );
+ }
+
+ private Degradation( PointF p, int[] matrix ) {
+
+ for (int i=0; i < matrix.length; i += 2) {
+ add( new Speck( p.x, p.y, matrix[i], matrix[i+1] ) );
+ add( new Speck( p.x, p.y, matrix[i], matrix[i+1] ) );
+ }
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ if (countLiving() == 0) {
+ killAndErase();
+ }
+ }
+
+ @Override
+ public void draw() {
+ GLES20.glBlendFunc( GL10.GL_SRC_ALPHA, GL10.GL_ONE );
+ super.draw();
+ GLES20.glBlendFunc( GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA );
+ }
+
+ public static class Speck extends PixelParticle {
+
+ private static final int COLOR = 0xFF4422;
+ private static final int SIZE = 3;
+
+ public Speck( float x0, float y0, int mx, int my ) {
+
+ super();
+ color( COLOR );
+
+ float x1 = x0 + mx * SIZE;
+ float y1 = y0 + my * SIZE;
+
+ PointF p = new PointF().polar( Random.Float( 2 * PointF.PI ), 8 );
+ x0 += p.x;
+ y0 += p.y;
+
+ float dx = x1 - x0;
+ float dy = y1 - y0;
+
+ x = x0;
+ y = y0;
+ speed.set( dx, dy );
+ acc.set( -dx / 4, -dy / 4 );
+
+ left = lifespan = 2f;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+
+ am = 1 - Math.abs( left / lifespan - 0.5f ) * 2;
+ am *= am;
+ size( am * SIZE );
+ }
+ }
+}
diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/effects/Flare.java b/src/com/shatteredpixel/shatteredpixeldungeon/effects/Flare.java
index df67c1c3f..a53454173 100644
--- a/src/com/shatteredpixel/shatteredpixeldungeon/effects/Flare.java
+++ b/src/com/shatteredpixel/shatteredpixeldungeon/effects/Flare.java
@@ -53,10 +53,6 @@ public class Flare extends Visual {
super( 0, 0, 0, 0 );
- // FIXME
- // Texture is incorrectly created every time we need
- // to show the effect, it must be refactored
-
int gradient[] = {0xFFFFFFFF, 0x00FFFFFF};
texture = new Gradient( gradient );
diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/effects/FloatingText.java b/src/com/shatteredpixel/shatteredpixeldungeon/effects/FloatingText.java
index e8b53bc47..dff2ab6e5 100644
--- a/src/com/shatteredpixel/shatteredpixeldungeon/effects/FloatingText.java
+++ b/src/com/shatteredpixel/shatteredpixeldungeon/effects/FloatingText.java
@@ -20,6 +20,7 @@ package com.shatteredpixel.shatteredpixeldungeon.effects;
import java.util.ArrayList;
import com.watabou.noosa.BitmapText;
+import com.watabou.noosa.Camera;
import com.watabou.noosa.Game;
import com.shatteredpixel.shatteredpixeldungeon.DungeonTilemap;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
@@ -34,17 +35,13 @@ public class FloatingText extends BitmapText {
private float timeLeft;
private int key = -1;
-
+
+ private float cameraZoom = -1;
+
private static SparseArray> stacks = new SparseArray>();
public FloatingText() {
-
super();
-
- PixelScene.chooseFont( 9 );
- font = PixelScene.font;
- scale.set( PixelScene.scale );
-
speed.y = - DISTANCE / LIFESPAN;
}
@@ -81,6 +78,13 @@ public class FloatingText extends BitmapText {
revive();
+ if (cameraZoom != Camera.main.zoom) {
+ cameraZoom = Camera.main.zoom;
+ PixelScene.chooseFont( 9, cameraZoom );
+ font = PixelScene.font;
+ scale.set( PixelScene.scale );
+ }
+
text( text );
hardlight( color );
diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/effects/Identification.java b/src/com/shatteredpixel/shatteredpixeldungeon/effects/Identification.java
index a0f67afb0..16c25be32 100644
--- a/src/com/shatteredpixel/shatteredpixeldungeon/effects/Identification.java
+++ b/src/com/shatteredpixel/shatteredpixeldungeon/effects/Identification.java
@@ -65,14 +65,17 @@ public class Identification extends Group {
}
public static class Speck extends PixelParticle {
+
+ private static final int COLOR = 0x4488CC;
+ private static final int SIZE = 3;
public Speck( float x0, float y0, int mx, int my ) {
super();
- color( 0x4488CC );
+ color( COLOR );
- float x1 = x0 + mx * 3;
- float y1 = y0 + my * 3;
+ float x1 = x0 + mx * SIZE;
+ float y1 = y0 + my * SIZE;
PointF p = new PointF().polar( Random.Float( 2 * PointF.PI ), 8 );
x0 += p.x;
@@ -95,7 +98,7 @@ public class Identification extends Group {
am = 1 - Math.abs( left / lifespan - 0.5f ) * 2;
am *= am;
- size( am * 2 );
+ size( am * SIZE );
}
}
}
diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/effects/ShadowBox.java b/src/com/shatteredpixel/shatteredpixeldungeon/effects/ShadowBox.java
new file mode 100644
index 000000000..54120e037
--- /dev/null
+++ b/src/com/shatteredpixel/shatteredpixeldungeon/effects/ShadowBox.java
@@ -0,0 +1,46 @@
+/*
+ * Pixel Dungeon
+ * Copyright (C) 2012-2015 Oleg Dolya
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see
+ */
+package com.shatteredpixel.shatteredpixeldungeon.effects;
+
+import com.watabou.gltextures.SmartTexture;
+import com.watabou.noosa.NinePatch;
+import com.watabou.pixeldungeon.Assets;
+
+public class ShadowBox extends NinePatch {
+
+ public static final float SIZE = 16;
+
+ public ShadowBox() {
+ super( Assets.SHADOW, 1 );
+
+ texture.filter( SmartTexture.LINEAR, SmartTexture.LINEAR );
+
+ scale.set( SIZE, SIZE );
+ }
+
+ @Override
+ public void size(float width, float height) {
+ super.size( width / SIZE, height / SIZE );
+ }
+
+ public void boxRect( float x, float y, float width, float height ) {
+ this.x = x - SIZE;
+ this.y = y - SIZE;
+ size( width + SIZE * 2, height + SIZE * 2 );
+ }
+}
diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/effects/Speck.java b/src/com/shatteredpixel/shatteredpixeldungeon/effects/Speck.java
index 6548f2c53..a79d558ca 100644
--- a/src/com/shatteredpixel/shatteredpixeldungeon/effects/Speck.java
+++ b/src/com/shatteredpixel/shatteredpixeldungeon/effects/Speck.java
@@ -136,7 +136,7 @@ public class Speck extends Image {
break;
case FORGE:
- speed.polar( Random.Float( -3.1415926f, 0 ), Random.Float( 64 ) );
+ speed.polar( Random.Float( -3.1415926f ), Random.Float( 64 ) );
acc.set( 0, 128 );
angle = Random.Float( 360 );
angularSpeed = Random.Float( -360, +360 );
@@ -144,7 +144,7 @@ public class Speck extends Image {
break;
case EVOKE:
- speed.polar( Random.Float( -3.1415926f, 0 ), 50 );
+ speed.polar( Random.Float( -3.1415926f ), 50 );
acc.set( 0, 50 );
angle = Random.Float( 360 );
angularSpeed = Random.Float( -180, +180 );
diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/BlastParticle.java b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/BlastParticle.java
new file mode 100644
index 000000000..965ea5b13
--- /dev/null
+++ b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/BlastParticle.java
@@ -0,0 +1,62 @@
+/*
+ * Pixel Dungeon
+ * Copyright (C) 2012-2015 Oleg Dolya
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see
+ */
+package com.shatteredpixel.shatteredpixeldungeon.effects.particles;
+
+import com.watabou.noosa.particles.Emitter;
+import com.watabou.noosa.particles.PixelParticle;
+import com.watabou.noosa.particles.Emitter.Factory;
+import com.watabou.utils.Random;
+
+public class BlastParticle extends PixelParticle.Shrinking {
+
+ public static final Factory FACTORY = new Factory() {
+ @Override
+ public void emit( Emitter emitter, int index, float x, float y ) {
+ ((BlastParticle)emitter.recycle( BlastParticle.class )).reset( x, y );
+ }
+ @Override
+ public boolean lightMode() {
+ return true;
+ };
+ };
+
+ public BlastParticle() {
+ super();
+
+ color( 0xEE7722 );
+ acc.set( 0, +50 );
+ }
+
+ public void reset( float x, float y ) {
+ revive();
+
+ this.x = x;
+ this.y = y;
+
+ left = lifespan = Random.Float();
+
+ size = 8;
+ speed.polar( -Random.Float( 3.1415926f ), Random.Float( 32, 64 ) );
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ am = left > 0.8f ? (1 - left) * 5 : 1;
+ }
+}
\ No newline at end of file
diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/EnergyParticle.java b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/EnergyParticle.java
index ed3f98a8a..6eae30326 100644
--- a/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/EnergyParticle.java
+++ b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/EnergyParticle.java
@@ -42,7 +42,7 @@ public class EnergyParticle extends PixelParticle {
lifespan = 1f;
color( 0xFFFFAA );
- speed.polar( Random.Float( 2 * PointF.PI ), Random.Float( 24, 32 ) );
+ speed.polar( Random.Float( PointF.PI2 ), Random.Float( 24, 32 ) );
}
public void reset( float x, float y ) {
diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/PoisonParticle.java b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/PoisonParticle.java
index aaf6fcfdb..b870efbf7 100644
--- a/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/PoisonParticle.java
+++ b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/PoisonParticle.java
@@ -63,7 +63,7 @@ public class PoisonParticle extends PixelParticle {
left = lifespan;
- speed.polar( Random.Float( 3.1415926f ), Random.Float( 6 ) );
+ speed.polar( -Random.Float( 3.1415926f ), Random.Float( 6 ) );
}
public void resetSplash( float x, float y ) {
diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/PurpleParticle.java b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/PurpleParticle.java
index 158339820..fe287a74e 100644
--- a/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/PurpleParticle.java
+++ b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/PurpleParticle.java
@@ -66,7 +66,7 @@ public class PurpleParticle extends PixelParticle {
this.x = x;
this.y = y;
- speed.polar( Random.Float( 360 ), Random.Float( 16, 32 ) );
+ speed.polar( Random.Float( PointF.PI2 ), Random.Float( 16, 32 ) );
left = lifespan;
}
diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/ShadowParticle.java b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/ShadowParticle.java
index 4d8461e3c..68718331c 100644
--- a/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/ShadowParticle.java
+++ b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/ShadowParticle.java
@@ -65,7 +65,7 @@ public class ShadowParticle extends PixelParticle.Shrinking {
size = 8;
left = lifespan = 0.5f;
- speed.polar( Random.Float( 2 * PointF.PI ), Random.Float( 16, 32 ) );
+ speed.polar( Random.Float( PointF.PI2 ), Random.Float( 16, 32 ) );
this.x = x - speed.x * lifespan;
this.y = y - speed.y * lifespan;
}
diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/SmokeParticle.java b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/SmokeParticle.java
new file mode 100644
index 000000000..2aae23fb8
--- /dev/null
+++ b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/SmokeParticle.java
@@ -0,0 +1,60 @@
+/*
+ * Pixel Dungeon
+ * Copyright (C) 2012-2015 Oleg Dolya
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see
+ */
+package com.shatteredpixel.shatteredpixeldungeon.effects.particles;
+
+import com.watabou.noosa.particles.Emitter;
+import com.watabou.noosa.particles.PixelParticle;
+import com.watabou.noosa.particles.Emitter.Factory;
+import com.watabou.utils.Random;
+
+public class SmokeParticle extends PixelParticle {
+
+ public static final Factory FACTORY = new Factory() {
+ @Override
+ public void emit( Emitter emitter, int index, float x, float y ) {
+ ((SmokeParticle)emitter.recycle( SmokeParticle.class )).reset( x, y );
+ }
+ };
+
+ public SmokeParticle() {
+ super();
+
+ color( 0x222222 );
+
+ acc.set( 0, -40 );
+ }
+
+ public void reset( float x, float y ) {
+ revive();
+
+ this.x = x;
+ this.y = y;
+
+ left = lifespan = Random.Float( 0.6f, 1f );
+ speed.set( Random.Float( -4, +4 ), Random.Float( -8, +8 ) );
+ }
+
+ @Override
+ public void update() {
+ super.update();
+
+ float p = left / lifespan;
+ am = p > 0.8f ? 2 - 2*p : p * 0.5f;
+ size( 16 - p * 8 );
+ }
+}
\ No newline at end of file
diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/SparkParticle.java b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/SparkParticle.java
index 9bf89999a..1a55e37c6 100644
--- a/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/SparkParticle.java
+++ b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/SparkParticle.java
@@ -51,7 +51,7 @@ public class SparkParticle extends PixelParticle {
left = lifespan = Random.Float( 0.5f, 1.0f );
- speed.polar( Random.Float( 3.1415926f ), Random.Float( 20, 40 ) );
+ speed.polar( -Random.Float( 3.1415926f ), Random.Float( 20, 40 ) );
}
@Override
diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/WindParticle.java b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/WindParticle.java
index 5b97533c2..ca87fe2d3 100644
--- a/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/WindParticle.java
+++ b/src/com/shatteredpixel/shatteredpixeldungeon/effects/particles/WindParticle.java
@@ -36,7 +36,7 @@ public class WindParticle extends PixelParticle {
}
};
- private static float angle = Random.Float( PointF.PI * 2 );
+ private static float angle = Random.Float( PointF.PI2 );
private static PointF speed = new PointF().polar( angle, 5 );