Merging 1.7.5 Source: effect changes
This commit is contained in:
parent
1b10338b37
commit
d6bcece8af
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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 <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
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 );
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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 );
|
||||
|
||||
|
|
|
@ -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<ArrayList<FloatingText>> stacks = new SparseArray<ArrayList<FloatingText>>();
|
||||
|
||||
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 );
|
||||
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
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 );
|
||||
}
|
||||
}
|
|
@ -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 );
|
||||
|
|
|
@ -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 <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -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 ) {
|
||||
|
|
|
@ -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 ) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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 <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
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 );
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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 );
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user