Skip to content

Commit

Permalink
PR cleanup for elevator surface panning
Browse files Browse the repository at this point in the history
  • Loading branch information
Interrupt committed Oct 13, 2020
1 parent e14c3a8 commit d07192d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
12 changes: 4 additions & 8 deletions Dungeoneer/src/com/interrupt/dungeoneer/game/Level.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,6 @@ public enum DungeonTheme {

public enum Source { LEVEL_START, LEVEL_LOAD, EDITOR, SPAWNED }
private enum Direction { NORTH, SOUTH, EAST, WEST }

public static int CURRENT_VERSION = 2;
public int version = -1;

public int width, height;
public Tile[] tiles;
Expand Down Expand Up @@ -236,9 +233,6 @@ public Level(int width, int height) {
// make a blank level for the editor
this.width = width;
this.height = height;

// Set a version for serialization purposes
version = CURRENT_VERSION;

tiles = new Tile[width * height];
tileMaterials = new TileMaterials[width * height];
Expand Down Expand Up @@ -524,9 +518,11 @@ public void postLoad() {
// Make sure the tile materials array matches the size of the tiles, and is filled
if(tileMaterials == null || tileMaterials.length != tiles.length) {
tileMaterials = new TileMaterials[tiles.length];
for(int i = 0; i < tiles.length; i++) {
}

for(int i = 0; i < tiles.length; i++) {
if(tileMaterials[i] == null)
tileMaterials[i] = new TileMaterials();
}
}
}

Expand Down
18 changes: 11 additions & 7 deletions Dungeoneer/src/com/interrupt/dungeoneer/tiles/Tile.java
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ public void rotate90() {

if(materials != null) {
materials.rotate90();
}
}
}

public static Tile copy(Tile tocopy) {
Expand Down Expand Up @@ -1050,9 +1050,8 @@ public float getWallYOffset(TileEdges dir) {
}

public void setWallYOffset(TileEdges dir, float val) {
if(materials == null) {
materials = new TileMaterials();
}
if(materials == null)
return;

TileSurface s = materials.getTopSurface(dir);
if(s == null) {
Expand Down Expand Up @@ -1081,9 +1080,8 @@ public float getBottomWallYOffset(TileEdges dir) {
}

public void setBottomWallYOffset(TileEdges dir, float val) {
if(materials == null) {
materials = new TileMaterials();
}
if(materials == null)
return;

TileSurface s = materials.getTopSurface(dir);
if(s == null) {
Expand All @@ -1095,6 +1093,9 @@ public void setBottomWallYOffset(TileEdges dir, float val) {
}

public void offsetTopWallSurfaces(float amount) {
if(materials == null)
return;

for(int i = 0; i < TileEdges.values().length; i++) {
TileEdges edge = TileEdges.values()[i];
TileSurface surface = materials.getTopSurface(edge);
Expand All @@ -1107,6 +1108,9 @@ public void offsetTopWallSurfaces(float amount) {
}

public void offsetBottomWallSurfaces(float amount) {
if(materials == null)
return;

for(int i = 0; i < TileEdges.values().length; i++) {
TileEdges edge = TileEdges.values()[i];
TileSurface surface = materials.getBottomSurface(edge);
Expand Down

0 comments on commit d07192d

Please sign in to comment.