mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2025-02-18 05:30:29 +00:00
wiz5 mazes
This commit is contained in:
parent
a2f2fb5d4e
commit
6725df8cd6
@ -75,8 +75,9 @@ 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_NEVER);
|
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
|
||||||
// imagePane.getVerticalScrollBar ().setUnitIncrement (font.getSize ());
|
imagePane.getVerticalScrollBar ().setUnitIncrement (50);
|
||||||
|
imagePane.getHorizontalScrollBar ().setUnitIncrement (25);
|
||||||
|
|
||||||
// setTabsFont (font);
|
// setTabsFont (font);
|
||||||
// this.setMinimumSize (new Dimension (800, 200));
|
// this.setMinimumSize (new Dimension (800, 200));
|
||||||
|
@ -4,75 +4,115 @@ import java.awt.Dimension;
|
|||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.RenderingHints;
|
import java.awt.RenderingHints;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.bytezone.diskbrowser.applefile.AbstractFile;
|
import com.bytezone.diskbrowser.applefile.AbstractFile;
|
||||||
import com.bytezone.diskbrowser.utilities.HexFormatter;
|
import com.bytezone.diskbrowser.utilities.HexFormatter;
|
||||||
|
|
||||||
public class MazeGridV5 extends AbstractFile
|
public class MazeGridV5 extends AbstractFile
|
||||||
{
|
{
|
||||||
MazeCell[][] grid = new MazeCell[8][8];
|
List<MazeGrid> grids = new ArrayList<MazeGrid> ();
|
||||||
|
|
||||||
public MazeGridV5 (String name, byte[] buffer)
|
public MazeGridV5 (String name, byte[] buffer)
|
||||||
{
|
{
|
||||||
super (name, buffer);
|
super (name, buffer);
|
||||||
|
|
||||||
for (int row = 0; row < 8; row++)
|
for (int i = 0; i < 16; i++)
|
||||||
for (int col = 0; col < 8; col++)
|
{
|
||||||
grid[row][col] = getLayout (row, col);
|
MazeCell[][] grid = new MazeCell[8][8];
|
||||||
|
for (int row = 0; row < 8; row++)
|
||||||
|
for (int col = 0; col < 8; col++)
|
||||||
|
grid[row][col] = getLayout (i, row, col);
|
||||||
|
|
||||||
|
MazeGrid mazeGrid = new MazeGrid ();
|
||||||
|
mazeGrid.grid = grid;
|
||||||
|
grids.add (mazeGrid);
|
||||||
|
mazeGrid.yOffset = buffer[512 + i] & 0xFF;
|
||||||
|
mazeGrid.xOffset = buffer[528 + i] & 0xFF;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BufferedImage getImage ()
|
public BufferedImage getImage ()
|
||||||
{
|
{
|
||||||
Dimension cellSize = new Dimension (22, 22);
|
Dimension cellSize = new Dimension (22, 22);
|
||||||
image = new BufferedImage (8 * cellSize.width + 1, 8 * cellSize.height + 1,
|
int gridWidth = 8 * cellSize.width + 1;
|
||||||
|
int gridHeight = 8 * cellSize.height + 1;
|
||||||
|
image = new BufferedImage (6 * gridWidth, 6 * gridHeight,
|
||||||
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);
|
||||||
|
|
||||||
for (int row = 0; row < 8; row++)
|
for (int i = 0; i < 16; i++)
|
||||||
for (int column = 0; column < 8; column++)
|
{
|
||||||
{
|
MazeGrid mazeGrid = grids.get (i);
|
||||||
MazeCell cell = grid[row][column];
|
for (int row = 0; row < 8; row++)
|
||||||
int x = column * cellSize.width;
|
for (int column = 0; column < 8; column++)
|
||||||
int y = image.getHeight () - (row + 1) * cellSize.height - 1;
|
{
|
||||||
cell.draw (g, x, y);
|
MazeCell cell = mazeGrid.grid[row][column];
|
||||||
}
|
int x = column * cellSize.width;
|
||||||
|
int y = image.getHeight () - (row + 1) * cellSize.height - 1;
|
||||||
|
x += (mazeGrid.xOffset - 0x80) * cellSize.width + 10 * cellSize.width;
|
||||||
|
y -= (mazeGrid.yOffset - 0x80) * cellSize.height + 10 * cellSize.height;
|
||||||
|
cell.draw (g, x, y);
|
||||||
|
}
|
||||||
|
}
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
private MazeCell getLayout (int row, int column)
|
private MazeCell getLayout (int gridNo, int row, int column)
|
||||||
{
|
{
|
||||||
MazeAddress address = new MazeAddress (0, row, column);
|
MazeAddress address = new MazeAddress (0, row, column);
|
||||||
MazeCell cell = new MazeCell (address);
|
MazeCell cell = new MazeCell (address);
|
||||||
|
|
||||||
int offset = column * 2 + row / 4;
|
int offset = gridNo * 16 + column * 2 + row / 4;
|
||||||
|
int value;
|
||||||
|
|
||||||
int value = HexFormatter.intValue (buffer[offset]);
|
if (false)
|
||||||
value >>>= (row % 4) * 2;
|
{
|
||||||
cell.westWall = ((value & 1) == 1);
|
value = HexFormatter.intValue (buffer[offset]);
|
||||||
value >>>= 1;
|
value >>>= (row % 4) * 2;
|
||||||
cell.westDoor = ((value & 1) == 1);
|
cell.westWall = ((value & 1) == 1);
|
||||||
|
value >>>= 1;
|
||||||
|
cell.westDoor = ((value & 1) == 1);
|
||||||
|
}
|
||||||
|
|
||||||
value = HexFormatter.intValue (buffer[offset + 16]);
|
if (false)
|
||||||
value >>>= (row % 4) * 2;
|
{
|
||||||
cell.southWall = ((value & 1) == 1);
|
value = HexFormatter.intValue (buffer[offset + 256]);
|
||||||
value >>>= 1;
|
value >>>= (row % 4) * 2;
|
||||||
cell.southDoor = ((value & 1) == 1);
|
cell.southWall = ((value & 1) == 1);
|
||||||
|
value >>>= 1;
|
||||||
|
cell.southDoor = ((value & 1) == 1);
|
||||||
|
}
|
||||||
|
|
||||||
value = HexFormatter.intValue (buffer[offset + 32]);
|
if (true)
|
||||||
value >>>= (row % 4) * 2;
|
{
|
||||||
cell.eastWall = ((value & 1) == 1);
|
value = HexFormatter.intValue (buffer[offset + 0]);
|
||||||
value >>>= 1;
|
value >>>= (row % 4) * 2;
|
||||||
cell.eastDoor = ((value & 1) == 1);
|
cell.eastWall = ((value & 1) == 1);
|
||||||
|
value >>>= 1;
|
||||||
|
cell.eastDoor = ((value & 1) == 1);
|
||||||
|
}
|
||||||
|
|
||||||
value = HexFormatter.intValue (buffer[offset + 48]);
|
if (true)
|
||||||
value >>>= (row % 4) * 2;
|
{
|
||||||
cell.northWall = ((value & 1) == 1);
|
value = HexFormatter.intValue (buffer[offset + 256]);
|
||||||
value >>>= 1;
|
value >>>= (row % 4) * 2;
|
||||||
cell.northDoor = ((value & 1) == 1);
|
cell.northWall = ((value & 1) == 1);
|
||||||
|
value >>>= 1;
|
||||||
|
cell.northDoor = ((value & 1) == 1);
|
||||||
|
}
|
||||||
|
|
||||||
return cell;
|
return cell;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class MazeGrid
|
||||||
|
{
|
||||||
|
MazeCell[][] grid = new MazeCell[8][8];
|
||||||
|
int xOffset;
|
||||||
|
int yOffset;
|
||||||
|
}
|
||||||
}
|
}
|
@ -67,6 +67,8 @@ public class Relocator extends AbstractFile
|
|||||||
byte[] temp = disk.readSector (diskOffsets[logicalBlock]);
|
byte[] temp = disk.readSector (diskOffsets[logicalBlock]);
|
||||||
DiskAddress da = master.getDiskAddress (logicalBlock);
|
DiskAddress da = master.getDiskAddress (logicalBlock);
|
||||||
master.writeSector (da, temp);
|
master.writeSector (da, temp);
|
||||||
|
// if (da.getBlock () == 0x126)
|
||||||
|
// System.out.println (HexFormatter.format (buffer));
|
||||||
// if (Utility.find (temp, key1))
|
// if (Utility.find (temp, key1))
|
||||||
// if (Utility.find (temp, key2))
|
// if (Utility.find (temp, key2))
|
||||||
// if (Utility.find (temp, key3))
|
// if (Utility.find (temp, key3))
|
||||||
|
@ -167,10 +167,11 @@ public class Wizardry4BootDisk extends PascalDisk
|
|||||||
|
|
||||||
DefaultMutableTreeNode mazeNode = linkNode ("Maze", "Level 5 mazes", scenarioNode);
|
DefaultMutableTreeNode mazeNode = linkNode ("Maze", "Level 5 mazes", scenarioNode);
|
||||||
|
|
||||||
|
int base = 0x1800;
|
||||||
for (int i = 0; i < 8; i++)
|
for (int i = 0; i < 8; i++)
|
||||||
{
|
{
|
||||||
int offset = 6144 + i * 256;
|
int offset = base + i * 1024;
|
||||||
byte[] data = new byte[256];
|
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 ("test level " + i, data);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user