v0.8.0: fixes/tweaks:
- damage numbers now appear where a sprite is arriving if it is moving - blob emitters can now have a defined bound within a cell - tweaked hero level exit/entrance behaviour - refactored game actions that are defined in GameAction.java
This commit is contained in:
@@ -38,9 +38,7 @@ public class SPDAction extends GameAction {
|
||||
|
||||
//--New references to existing actions from GameAction
|
||||
public static final GameAction NONE = GameAction.NONE;
|
||||
|
||||
public static final GameAction BACK = GameAction.BACK;
|
||||
public static final GameAction MENU = GameAction.MENU;
|
||||
//--
|
||||
|
||||
public static final GameAction HERO_INFO = new SPDAction("hero_info");
|
||||
@@ -75,8 +73,8 @@ public class SPDAction extends GameAction {
|
||||
|
||||
private static final LinkedHashMap<Integer, GameAction> defaultBindings = new LinkedHashMap<>();
|
||||
static {
|
||||
defaultBindings.put( Input.Keys.BACK, SPDAction.BACK );
|
||||
defaultBindings.put( Input.Keys.MENU, SPDAction.MENU );
|
||||
defaultBindings.put( Input.Keys.ESCAPE, SPDAction.BACK );
|
||||
defaultBindings.put( Input.Keys.BACKSPACE, SPDAction.BACK );
|
||||
|
||||
defaultBindings.put( Input.Keys.H, SPDAction.HERO_INFO );
|
||||
defaultBindings.put( Input.Keys.J, SPDAction.JOURNAL );
|
||||
@@ -120,6 +118,12 @@ public class SPDAction extends GameAction {
|
||||
return new LinkedHashMap<>(defaultBindings);
|
||||
}
|
||||
|
||||
//hard bindings for android devices
|
||||
static {
|
||||
KeyBindings.addHardBinding( Input.Keys.BACK, SPDAction.BACK );
|
||||
KeyBindings.addHardBinding( Input.Keys.MENU, SPDAction.INVENTORY );
|
||||
}
|
||||
|
||||
//we only save/loads keys which differ from the default configuration.
|
||||
private static final String BINDINGS_FILE = "keybinds.dat";
|
||||
|
||||
|
||||
@@ -846,8 +846,10 @@ public class Hero extends Char {
|
||||
|
||||
private boolean actDescend( HeroAction.Descend action ) {
|
||||
int stairs = action.dst;
|
||||
if (pos == stairs && (Dungeon.level.map[pos] == Terrain.EXIT
|
||||
|| Dungeon.level.map[pos] == Terrain.UNLOCKED_EXIT)) {
|
||||
|
||||
//there can be multiple exit tiles, so descend on any of them
|
||||
//TODO this is slightly brittle, it assumes there are no disjointed sets of exit tiles
|
||||
if ((Dungeon.level.map[pos] == Terrain.EXIT || Dungeon.level.map[pos] == Terrain.UNLOCKED_EXIT)) {
|
||||
|
||||
curAction = null;
|
||||
|
||||
@@ -873,7 +875,10 @@ public class Hero extends Char {
|
||||
|
||||
private boolean actAscend( HeroAction.Ascend action ) {
|
||||
int stairs = action.dst;
|
||||
if (pos == stairs && Dungeon.level.map[pos] == Terrain.ENTRANCE) {
|
||||
|
||||
//there can be multiple entrance tiles, so descend on any of them
|
||||
//TODO this is slightly brittle, it assumes there are no disjointed sets of entrance tiles
|
||||
if (Dungeon.level.map[pos] == Terrain.ENTRANCE) {
|
||||
|
||||
if (Dungeon.depth == 1) {
|
||||
|
||||
|
||||
+5
-2
@@ -26,6 +26,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap;
|
||||
import com.watabou.noosa.particles.Emitter;
|
||||
import com.watabou.utils.Random;
|
||||
import com.watabou.utils.RectF;
|
||||
|
||||
public class BlobEmitter extends Emitter {
|
||||
|
||||
@@ -38,6 +39,8 @@ public class BlobEmitter extends Emitter {
|
||||
this.blob = blob;
|
||||
blob.use( this );
|
||||
}
|
||||
|
||||
public RectF bound = new RectF(0, 0, 1, 1);
|
||||
|
||||
@Override
|
||||
protected void emit( int index ) {
|
||||
@@ -59,8 +62,8 @@ public class BlobEmitter extends Emitter {
|
||||
if (cell < Dungeon.level.heroFOV.length
|
||||
&& (Dungeon.level.heroFOV[cell] || blob.alwaysVisible)
|
||||
&& map[cell] > 0) {
|
||||
float x = (i + Random.Float()) * size;
|
||||
float y = (j + Random.Float()) * size;
|
||||
float x = (i + Random.Float(bound.left, bound.right)) * size;
|
||||
float y = (j + Random.Float(bound.top, bound.bottom)) * size;
|
||||
factory.emit(this, index, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -650,13 +650,6 @@ public class GameScene extends PixelScene {
|
||||
add( new WndGame() );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMenuPressed() {
|
||||
if (Dungeon.hero.ready) {
|
||||
selectItem( null, WndBag.Mode.ALL, null );
|
||||
}
|
||||
}
|
||||
|
||||
public void addCustomTile( CustomTilemap visual){
|
||||
customTiles.add( visual.create() );
|
||||
|
||||
@@ -180,10 +180,12 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip
|
||||
if (args.length > 0) {
|
||||
text = Messages.format( text, args );
|
||||
}
|
||||
float x = destinationCenter().x;
|
||||
float y = destinationCenter().y - height()/2f;
|
||||
if (ch != null) {
|
||||
FloatingText.show( x + width() * 0.5f, y, ch.pos, text, color );
|
||||
FloatingText.show( x, y, ch.pos, text, color );
|
||||
} else {
|
||||
FloatingText.show( x + width() * 0.5f, y, text, color );
|
||||
FloatingText.show( x, y, text, color );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,10 +160,6 @@ public class Window extends Group implements Signal.Listener<KeyEvent> {
|
||||
if (event.pressed) {
|
||||
if (KeyBindings.getActionForKey( event ) == SPDAction.BACK){
|
||||
onBackPressed();
|
||||
|
||||
} else if (KeyBindings.getActionForKey( event ) == SPDAction.MENU){
|
||||
onMenuPressed();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,7 +171,5 @@ public class Window extends Group implements Signal.Listener<KeyEvent> {
|
||||
public void onBackPressed() {
|
||||
hide();
|
||||
}
|
||||
|
||||
public void onMenuPressed() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ package com.shatteredpixel.shatteredpixeldungeon.windows;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.SPDAction;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Belongings;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.EquipableItem;
|
||||
@@ -55,6 +56,8 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.ItemSlot;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.QuickSlotButton;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock;
|
||||
import com.watabou.gltextures.TextureCache;
|
||||
import com.watabou.input.KeyBindings;
|
||||
import com.watabou.input.KeyEvent;
|
||||
import com.watabou.noosa.BitmapText;
|
||||
import com.watabou.noosa.ColorBlock;
|
||||
import com.watabou.noosa.Game;
|
||||
@@ -244,11 +247,14 @@ public class WndBag extends WndTabbed {
|
||||
|
||||
count++;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onMenuPressed() {
|
||||
if (listener == null) {
|
||||
public boolean onSignal(KeyEvent event) {
|
||||
if (event.pressed && KeyBindings.getActionForKey( event ) == SPDAction.INVENTORY) {
|
||||
hide();
|
||||
return true;
|
||||
} else {
|
||||
return super.onSignal(event);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -99,8 +99,8 @@ public class WndKeyBindings extends Window {
|
||||
|
||||
int y = 0;
|
||||
for (GameAction action : GameAction.allActions()){
|
||||
//start at 3. No bindings for NONE, BACK, and MENU atm
|
||||
if (action.code() < 3) continue;
|
||||
//start at 1. No bindings for NONE
|
||||
if (action.code() < 1) continue;
|
||||
|
||||
BindingItem item = new BindingItem(action);
|
||||
item.setRect(0, y, WIDTH, BindingItem.HEIGHT);
|
||||
@@ -192,7 +192,7 @@ public class WndKeyBindings extends Window {
|
||||
actionName.setHightlighting(false);
|
||||
add(actionName);
|
||||
|
||||
ArrayList<Integer> keys = KeyBindings.getKeysForAction(action);
|
||||
ArrayList<Integer> keys = KeyBindings.getBoundKeysForAction(action);
|
||||
origKey1 = key1 = keys.isEmpty() ? 0 : keys.remove(0);
|
||||
origKey2 = key2 = keys.isEmpty() ? 0 : keys.remove(0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user