Skip to content

Commit

Permalink
More elevator wall texture panning cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Interrupt committed Oct 13, 2020
1 parent d07192d commit 1cc4c17
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3490,7 +3490,7 @@ else if(pickedSurface.edge == TileEdges.West) {
floodFillWallTexture(x - nextXOffset, y - nextYOffset, checkTex, checkAtlas, adjacent);
}

public void panSurfaceV(byte amt) {
public void panSurfaceY(float amt) {
if(pickedSurface.isPicked) {
Tile t = level.getTileOrNull((int) pickedSurface.position.x, (int) pickedSurface.position.z);
if(t == null)
Expand All @@ -3499,9 +3499,9 @@ public void panSurfaceV(byte amt) {
boolean isUpperWall = pickedSurface.tileSurface == TileSurface.UpperWall;

if(isUpperWall)
t.setWallYOffset(pickedSurface.edge, (byte)(t.getWallYOffset(pickedSurface.edge) + amt));
t.offsetTopWallSurfaces(pickedSurface.edge, amt);
else
t.setBottomWallYOffset(pickedSurface.edge, (byte)(t.getBottomWallYOffset(pickedSurface.edge) + amt));
t.offsetBottomWallSurfaces(pickedSurface.edge, amt);

markWorldAsDirty((int)pickedSurface.position.x, (int)pickedSurface.position.y, 1);
history.saveState(level);
Expand Down
8 changes: 4 additions & 4 deletions Dungeoneer/src/com/interrupt/dungeoneer/tiles/Tile.java
Original file line number Diff line number Diff line change
Expand Up @@ -1049,7 +1049,7 @@ public float getWallYOffset(TileEdges dir) {
return found;
}

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

Expand All @@ -1059,7 +1059,7 @@ public void setWallYOffset(TileEdges dir, float val) {
materials.setTopSurface(dir, s);
}

s.yOffset = val;
s.yOffset += val;
}

public float getBottomWallYOffset(TileEdges dir) {
Expand All @@ -1079,7 +1079,7 @@ public float getBottomWallYOffset(TileEdges dir) {
return found;
}

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

Expand All @@ -1089,7 +1089,7 @@ public void setBottomWallYOffset(TileEdges dir, float val) {
materials.setBottomSurface(dir, s);
}

s.yOffset = val;
s.yOffset += val;
}

public void offsetTopWallSurfaces(float amount) {
Expand Down
12 changes: 0 additions & 12 deletions Dungeoneer/src/com/interrupt/dungeoneer/tiles/TileMaterials.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,4 @@ public void setTopSurface(TileEdges dir, TileSurface s) {
public void setBottomSurface(TileEdges dir, TileSurface s) {
bottomSurfaces.put(dir, s);
}

public void offsetBottomSurfaces(float moving) {
for(int i = 0; i < bottomSurfaces.size; i++) {
bottomSurfaces.getValueAt(i).yOffset += moving;
}
}

public void offsetTopSurfaces(float moving) {
for(int i = 0; i < topSurfaces.size; i++) {
topSurfaces.getValueAt(i).yOffset += moving;
}
}
}

0 comments on commit 1cc4c17

Please sign in to comment.