v2.2.0: visual changes so crystal spires can have adjacent terrain

This commit is contained in:
Evan Debenham
2023-09-25 00:49:50 -04:00
parent 7f5c82ee81
commit 41602afd8c
7 changed files with 45 additions and 13 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 995 B

View File

@@ -111,11 +111,6 @@ public class CrystalSpire extends Mob {
for (int i : cellsToAttack){
//TODO would be nice to find a way to crystal these cells
if(i == pos+1 || i == pos-1 || i == pos-Dungeon.level.width() || i == pos-2*Dungeon.level.width()){
continue; //don't spawn crystals in these locations
}
Char ch = Actor.findChar(i);
if (ch instanceof CrystalGuardian || ch instanceof CrystalSpire){
continue; //don't spawn crystals on these chars

View File

@@ -59,11 +59,7 @@ public class MineGiantRoom extends CaveRoom {
CrystalSpire m = new CrystalSpire();
m.pos = level.pointToCell(p);
level.mobs.add(m);
Painter.set(level, p, Terrain.CUSTOM_DECO_EMPTY);
Painter.set(level, p.x-1, p.y, Terrain.CUSTOM_DECO_EMPTY);
Painter.set(level, p.x+1, p.y, Terrain.CUSTOM_DECO_EMPTY);
Painter.set(level, p.x, p.y-1, Terrain.CUSTOM_DECO_EMPTY);
Painter.set(level, p.x, p.y-2, Terrain.CUSTOM_DECO_EMPTY);
Painter.set(level, p, Terrain.EMPTY);
} else {
Painter.fillEllipse(level, this, 3, Terrain.EMPTY);

View File

@@ -22,8 +22,11 @@
package com.shatteredpixel.shatteredpixeldungeon.sprites;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.effects.Splash;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonWallsTilemap;
import com.watabou.noosa.TextureFilm;
public abstract class CrystalSpireSprite extends MobSprite {
@@ -39,7 +42,7 @@ public abstract class CrystalSpireSprite extends MobSprite {
public CrystalSpireSprite(){
texture( Assets.Sprites.CRYSTAL_SPIRE );
TextureFilm frames = new TextureFilm( texture, 30, 45 );
TextureFilm frames = new TextureFilm( texture, 24, 41 );
int c = texOffset();
@@ -62,7 +65,7 @@ public abstract class CrystalSpireSprite extends MobSprite {
hpPercent = ch.HP/(float)ch.HT;
}
TextureFilm frames = new TextureFilm( texture, 30, 45 );
TextureFilm frames = new TextureFilm( texture, 24, 41 );
if (hpPercent > 0.8f){
idle.frames( frames, 0+texOffset() );
@@ -85,10 +88,35 @@ public abstract class CrystalSpireSprite extends MobSprite {
updateIdle();
}
boolean wasVisible = false;
@Override
public void update() {
super.update();
if (curAnim != die && ch != null && visible != wasVisible){
if (visible){
DungeonWallsTilemap.skipCells.add(ch.pos - 2*Dungeon.level.width());
DungeonWallsTilemap.skipCells.add(ch.pos - Dungeon.level.width());
} else {
DungeonWallsTilemap.skipCells.remove(ch.pos - 2*Dungeon.level.width());
DungeonWallsTilemap.skipCells.remove(ch.pos - Dungeon.level.width());
}
GameScene.updateMap(ch.pos-2*Dungeon.level.width());
GameScene.updateMap(ch.pos-Dungeon.level.width());
wasVisible = visible;
}
}
@Override
public void die() {
super.die();
Splash.around(this, blood(), 100);
if (ch != null && visible){
DungeonWallsTilemap.skipCells.remove(ch.pos - 2*Dungeon.level.width());
DungeonWallsTilemap.skipCells.remove(ch.pos - Dungeon.level.width());
GameScene.updateMap(ch.pos-2*Dungeon.level.width());
GameScene.updateMap(ch.pos-Dungeon.level.width());
}
}
protected abstract int texOffset();

View File

@@ -393,6 +393,7 @@ public class DungeonTileSheet {
directVisuals.put(Terrain.SECRET_TRAP, directVisuals.get(Terrain.EMPTY));
directVisuals.put(Terrain.TRAP, directVisuals.get(Terrain.EMPTY));
directVisuals.put(Terrain.INACTIVE_TRAP, directVisuals.get(Terrain.EMPTY));
directVisuals.put(Terrain.CUSTOM_DECO, directVisuals.get(Terrain.EMPTY));
directVisuals.put(Terrain.CUSTOM_DECO_EMPTY,directVisuals.get(Terrain.EMPTY));
directVisuals.put(Terrain.EMPTY_DECO, FLOOR_DECO);

View File

@@ -24,10 +24,15 @@ package com.shatteredpixel.shatteredpixeldungeon.tiles;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import java.util.HashSet;
public class DungeonWallsTilemap extends DungeonTilemap {
public static HashSet<Integer> skipCells = new HashSet<>();
public DungeonWallsTilemap(){
super(Dungeon.level.tilesTex());
skipCells.clear();
map( Dungeon.level.map, Dungeon.level.width() );
}
@@ -62,6 +67,9 @@ public class DungeonWallsTilemap extends DungeonTilemap {
}
if (skipCells.contains(pos)){
return -1;
}
if (map[pos] == Terrain.LOCKED_EXIT || map[pos] == Terrain.UNLOCKED_EXIT){
return DungeonTileSheet.EXIT_UNDERHANG;

View File

@@ -35,7 +35,11 @@ public class RaisedTerrainTilemap extends DungeonTilemap {
protected int getTileVisual(int pos, int tile, boolean flat) {
if (flat) return -1;
if (DungeonWallsTilemap.skipCells.contains(pos)){
return -1;
}
if (tile == Terrain.HIGH_GRASS){
return DungeonTileSheet.getVisualWithAlts(
DungeonTileSheet.HIGH_GRASS_UNDERHANG,