mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2025-02-18 05:30:29 +00:00
more wiz5 maps
This commit is contained in:
parent
6725df8cd6
commit
cca29c3bcd
@ -75,7 +75,7 @@ class DataPanel extends JTabbedPane
|
|||||||
imagePanel = new ImagePanel ();
|
imagePanel = new ImagePanel ();
|
||||||
imagePane =
|
imagePane =
|
||||||
new JScrollPane (imagePanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
|
new JScrollPane (imagePanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
|
||||||
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
|
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||||
imagePane.getVerticalScrollBar ().setUnitIncrement (50);
|
imagePane.getVerticalScrollBar ().setUnitIncrement (50);
|
||||||
imagePane.getHorizontalScrollBar ().setUnitIncrement (25);
|
imagePane.getHorizontalScrollBar ().setUnitIncrement (25);
|
||||||
|
|
||||||
|
@ -57,6 +57,9 @@ class MazeCell
|
|||||||
|
|
||||||
public void draw (Graphics2D g, int x, int y)
|
public void draw (Graphics2D g, int x, int y)
|
||||||
{
|
{
|
||||||
|
g.setColor (Color.BLACK);
|
||||||
|
g.fillRect (x, y, 22, 22);
|
||||||
|
|
||||||
g.setColor (Color.WHITE);
|
g.setColor (Color.WHITE);
|
||||||
|
|
||||||
if (westWall)
|
if (westWall)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.bytezone.diskbrowser.wizardry;
|
package com.bytezone.diskbrowser.wizardry;
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.RenderingHints;
|
import java.awt.RenderingHints;
|
||||||
@ -13,6 +14,10 @@ import com.bytezone.diskbrowser.utilities.HexFormatter;
|
|||||||
public class MazeGridV5 extends AbstractFile
|
public class MazeGridV5 extends AbstractFile
|
||||||
{
|
{
|
||||||
List<MazeGrid> grids = new ArrayList<MazeGrid> ();
|
List<MazeGrid> grids = new ArrayList<MazeGrid> ();
|
||||||
|
int minX = 9999;
|
||||||
|
int minY = 9999;
|
||||||
|
int maxX = 0;
|
||||||
|
int maxY = 0;
|
||||||
|
|
||||||
public MazeGridV5 (String name, byte[] buffer)
|
public MazeGridV5 (String name, byte[] buffer)
|
||||||
{
|
{
|
||||||
@ -25,11 +30,14 @@ public class MazeGridV5 extends AbstractFile
|
|||||||
for (int col = 0; col < 8; col++)
|
for (int col = 0; col < 8; col++)
|
||||||
grid[row][col] = getLayout (i, row, col);
|
grid[row][col] = getLayout (i, row, col);
|
||||||
|
|
||||||
MazeGrid mazeGrid = new MazeGrid ();
|
MazeGrid mazeGrid =
|
||||||
mazeGrid.grid = grid;
|
new MazeGrid (grid, buffer[528 + i] & 0xFF, buffer[512 + i] & 0xFF);
|
||||||
grids.add (mazeGrid);
|
grids.add (mazeGrid);
|
||||||
mazeGrid.yOffset = buffer[512 + i] & 0xFF;
|
|
||||||
mazeGrid.xOffset = buffer[528 + i] & 0xFF;
|
minX = Math.min (minX, mazeGrid.xOffset);
|
||||||
|
minY = Math.min (minY, mazeGrid.yOffset);
|
||||||
|
maxX = Math.max (maxX, mazeGrid.xOffset);
|
||||||
|
maxY = Math.max (maxY, mazeGrid.yOffset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,14 +45,20 @@ public class MazeGridV5 extends AbstractFile
|
|||||||
public BufferedImage getImage ()
|
public BufferedImage getImage ()
|
||||||
{
|
{
|
||||||
Dimension cellSize = new Dimension (22, 22);
|
Dimension cellSize = new Dimension (22, 22);
|
||||||
int gridWidth = 8 * cellSize.width + 1;
|
int fudge = 30;
|
||||||
int gridHeight = 8 * cellSize.height + 1;
|
|
||||||
image = new BufferedImage (6 * gridWidth, 6 * gridHeight,
|
int gridWidth = (maxX - minX + 8) * cellSize.width;
|
||||||
|
int gridHeight = (maxY - minY + 7) * cellSize.height;
|
||||||
|
|
||||||
|
image = new BufferedImage (gridWidth + 1, gridHeight + fudge,
|
||||||
BufferedImage.TYPE_USHORT_555_RGB);
|
BufferedImage.TYPE_USHORT_555_RGB);
|
||||||
Graphics2D g = image.createGraphics ();
|
Graphics2D g = image.createGraphics ();
|
||||||
g.setRenderingHint (RenderingHints.KEY_ANTIALIASING,
|
g.setRenderingHint (RenderingHints.KEY_ANTIALIASING,
|
||||||
RenderingHints.VALUE_ANTIALIAS_ON);
|
RenderingHints.VALUE_ANTIALIAS_ON);
|
||||||
|
|
||||||
|
g.setColor (Color.LIGHT_GRAY);
|
||||||
|
g.fillRect (0, 0, gridWidth + 1, gridHeight + fudge);
|
||||||
|
|
||||||
for (int i = 0; i < 16; i++)
|
for (int i = 0; i < 16; i++)
|
||||||
{
|
{
|
||||||
MazeGrid mazeGrid = grids.get (i);
|
MazeGrid mazeGrid = grids.get (i);
|
||||||
@ -53,9 +67,9 @@ public class MazeGridV5 extends AbstractFile
|
|||||||
{
|
{
|
||||||
MazeCell cell = mazeGrid.grid[row][column];
|
MazeCell cell = mazeGrid.grid[row][column];
|
||||||
int x = column * cellSize.width;
|
int x = column * cellSize.width;
|
||||||
int y = image.getHeight () - (row + 1) * cellSize.height - 1;
|
int y = image.getHeight () - (row) * cellSize.height;
|
||||||
x += (mazeGrid.xOffset - 0x80) * cellSize.width + 10 * cellSize.width;
|
x += (mazeGrid.xOffset - minX) * cellSize.width;
|
||||||
y -= (mazeGrid.yOffset - 0x80) * cellSize.height + 10 * cellSize.height;
|
y -= (mazeGrid.yOffset - minY) * cellSize.height + fudge;
|
||||||
cell.draw (g, x, y);
|
cell.draw (g, x, y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -111,8 +125,15 @@ public class MazeGridV5 extends AbstractFile
|
|||||||
|
|
||||||
private class MazeGrid
|
private class MazeGrid
|
||||||
{
|
{
|
||||||
MazeCell[][] grid = new MazeCell[8][8];
|
MazeCell[][] grid;
|
||||||
int xOffset;
|
int xOffset;
|
||||||
int yOffset;
|
int yOffset;
|
||||||
|
|
||||||
|
public MazeGrid (MazeCell[][] grid, int x, int y)
|
||||||
|
{
|
||||||
|
this.grid = grid;
|
||||||
|
this.xOffset = x;
|
||||||
|
this.yOffset = y;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -173,7 +173,7 @@ public class Wizardry4BootDisk extends PascalDisk
|
|||||||
int offset = base + i * 1024;
|
int offset = base + i * 1024;
|
||||||
byte[] data = new byte[1024];
|
byte[] data = new byte[1024];
|
||||||
System.arraycopy (buffer, offset, data, 0, data.length);
|
System.arraycopy (buffer, offset, data, 0, data.length);
|
||||||
MazeGridV5 grid = new MazeGridV5 ("test level " + i, data);
|
MazeGridV5 grid = new MazeGridV5 ("Maze level " + (i + 1), data);
|
||||||
|
|
||||||
List<DiskAddress> mazeBlocks = new ArrayList<DiskAddress> ();
|
List<DiskAddress> mazeBlocks = new ArrayList<DiskAddress> ();
|
||||||
addToNode (grid, mazeNode, mazeBlocks);
|
addToNode (grid, mazeNode, mazeBlocks);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user