Merging Source v1.7.2: effects changes

This commit is contained in:
Evan Debenham
2014-10-20 23:00:20 -04:00
parent 1e62a6bd88
commit 724338b57f
4 changed files with 76 additions and 50 deletions

View File

@@ -208,6 +208,9 @@ public class BadgeBanner extends Image {
break;
case 38:
p.offset( 5, 5 );
break;
case 39:
p.offset( 5, 4 );
break;
case 40:
case 41:

View File

@@ -22,25 +22,29 @@ import com.shatteredpixel.shatteredpixeldungeon.Assets;
public class BannerSprites {
public enum Type {
PIXEL_DUNGEON,
BOSS_SLAIN,
GAME_OVER
};
public static Image get( Type type ) {
Image icon = new Image( Assets.BANNERS );
switch (type) {
case PIXEL_DUNGEON:
icon.frame( icon.texture.uvRect( 0, 0, 128, 70 ) );
break;
case BOSS_SLAIN:
icon.frame( icon.texture.uvRect( 0, 70, 128, 105 ) );
break;
case GAME_OVER:
icon.frame( icon.texture.uvRect( 0, 105, 128, 140 ) );
break;
}
return icon;
}
public enum Type {
PIXEL_DUNGEON,
BOSS_SLAIN,
GAME_OVER,
SELECT_YOUR_HERO
};
public static Image get( Type type ) {
Image icon = new Image( Assets.BANNERS );
switch (type) {
case PIXEL_DUNGEON:
icon.frame( icon.texture.uvRect( 0, 0, 128, 70 ) );
break;
case BOSS_SLAIN:
icon.frame( icon.texture.uvRect( 0, 70, 128, 105 ) );
break;
case GAME_OVER:
icon.frame( icon.texture.uvRect( 0, 105, 128, 140 ) );
break;
case SELECT_YOUR_HERO:
icon.frame( icon.texture.uvRect( 0, 140, 128, 161 ) );
break;
}
return icon;
}
}

View File

@@ -52,7 +52,8 @@ public class Flare extends Visual {
public Flare( int nRays, float radius ) {
super( 0, 0, 0, 0 );
// FIXME
// Texture is incorrectly created every time we need
// to show the effect, it must be refactored

View File

@@ -58,6 +58,7 @@ public class Speck extends Image {
public static final int DUST = 109;
public static final int STENCH = 110;
public static final int FORGE = 111;
public static final int CONFUSION = 112;
private static final int SIZE = 7;
@@ -100,8 +101,9 @@ public class Speck extends Image {
case JET:
case TOXIC:
case PARALYSIS:
case DUST:
case STENCH:
case CONFUSION:
case DUST:
frame( film.get( STEAM ) );
break;
default:
@@ -274,13 +276,6 @@ public class Speck extends Image {
angle = Random.Float( 360 );
lifespan = Random.Float( 1f, 3f );
break;
case DUST:
hardlight( 0xFFFF66 );
angle = Random.Float( 360 );
speed.polar( Random.Float( 2 * 3.1415926f ), Random.Float( 16, 48 ) );
lifespan = 0.5f;
break;
case STENCH:
hardlight( 0x003300 );
@@ -288,8 +283,22 @@ public class Speck extends Image {
angle = Random.Float( 360 );
lifespan = Random.Float( 1f, 3f );
break;
case COIN:
case CONFUSION:
hardlight( Random.Int( 0x1000000 ) | 0x000080 );
angularSpeed = Random.Float( -20, +20 );
angle = Random.Float( 360 );
lifespan = Random.Float( 1f, 3f );
break;
case DUST:
hardlight( 0xFFFF66 );
angle = Random.Float( 360 );
speed.polar( Random.Float( 2 * 3.1415926f ), Random.Float( 16, 48 ) );
lifespan = 0.5f;
break;
case COIN:
speed.polar( -PointF.PI * Random.Float( 0.3f, 0.7f ), Random.Float( 48, 96 ) );
acc.y = 256;
lifespan = -speed.y / acc.y * 2;
@@ -389,6 +398,7 @@ public class Speck extends Image {
case STEAM:
case TOXIC:
case PARALYSIS:
case CONFUSION:
case DUST:
am = p < 0.5f ? p : 1 - p;
scale.set( 1 + p * 2 );
@@ -412,22 +422,30 @@ public class Speck extends Image {
}
}
}
public static Emitter.Factory factory( final int type ) {
Emitter.Factory factory = factories.get( type );
if (factory == null) {
factory = new Emitter.Factory() {
@Override
public void emit ( Emitter emitter, int index, float x, float y ) {
Speck p = (Speck)emitter.recycle( Speck.class );
p.reset( index, x, y, type );
}
};
factories.put( type, factory );
}
return factory;
}
public static Emitter.Factory factory( final int type ) {
return factory( type, false );
}
public static Emitter.Factory factory( final int type, final boolean lightMode ) {
Emitter.Factory factory = factories.get( type );
if (factory == null) {
factory = new Emitter.Factory() {
@Override
public void emit ( Emitter emitter, int index, float x, float y ) {
Speck p = (Speck)emitter.recycle( Speck.class );
p.reset( index, x, y, type );
}
@Override
public boolean lightMode() {
return lightMode;
}
};
factories.put( type, factory );
}
return factory;
}
}