method header lines

This commit is contained in:
Denis Molony 2020-02-11 17:29:55 +10:00
parent 846c975be6
commit ebeea4706d
28 changed files with 3677 additions and 3223 deletions

View File

@ -2,9 +2,13 @@ package com.bytezone.diskbrowser.wizardry;
import com.bytezone.diskbrowser.applefile.AbstractFile;
public abstract class AbstractImage extends AbstractFile
// -----------------------------------------------------------------------------------//
abstract class AbstractImage extends AbstractFile
// -----------------------------------------------------------------------------------//
{
public AbstractImage (String name, byte[] buffer)
// ---------------------------------------------------------------------------------//
AbstractImage (String name, byte[] buffer)
// ---------------------------------------------------------------------------------//
{
super (name, buffer);
}

View File

@ -8,7 +8,9 @@ import java.util.List;
import com.bytezone.diskbrowser.applefile.AbstractFile;
import com.bytezone.diskbrowser.utilities.HexFormatter;
// -----------------------------------------------------------------------------------//
class Character extends AbstractFile
// -----------------------------------------------------------------------------------//
{
private final Attributes attributes;
private final Statistics stats;
@ -24,7 +26,9 @@ class Character extends AbstractFile
static String[] statuses =
{ "OK", "Afraid", "Asleep", "Paralyze", "Stoned", "Dead", "Ashes", "Lost" };
public Character (String name, byte[] buffer, int scenario)
// ---------------------------------------------------------------------------------//
Character (String name, byte[] buffer, int scenario)
// ---------------------------------------------------------------------------------//
{
super (name, buffer);
this.scenario = scenario;
@ -77,7 +81,9 @@ class Character extends AbstractFile
attributes.array[5] = attributes.luck;
}
// ---------------------------------------------------------------------------------//
public void linkItems (List<Item> itemList)
// ---------------------------------------------------------------------------------//
{
boolean equipped;
boolean identified;
@ -104,7 +110,9 @@ class Character extends AbstractFile
}
}
// ---------------------------------------------------------------------------------//
public void linkSpells (List<Spell> spellList)
// ---------------------------------------------------------------------------------//
{
for (int i = 138; i < 145; i++)
for (int bit = 0; bit < 8; bit++)
@ -119,8 +127,10 @@ class Character extends AbstractFile
}
}
// ---------------------------------------------------------------------------------//
@Override
public String getText ()
// ---------------------------------------------------------------------------------//
{
StringBuilder text = new StringBuilder ();
@ -171,12 +181,16 @@ class Character extends AbstractFile
return text.toString ();
}
// ---------------------------------------------------------------------------------//
public void linkExperience (ExperienceLevel exp)
// ---------------------------------------------------------------------------------//
{
stats.nextLevel = exp.getExperiencePoints (stats.level);
}
// ---------------------------------------------------------------------------------//
public int[] getMageSpellPoints ()
// ---------------------------------------------------------------------------------//
{
int[] spells = new int[7];
@ -186,7 +200,9 @@ class Character extends AbstractFile
return spells;
}
// ---------------------------------------------------------------------------------//
public int[] getPriestSpellPoints ()
// ---------------------------------------------------------------------------------//
{
int[] spells = new int[7];
@ -196,13 +212,17 @@ class Character extends AbstractFile
return spells;
}
// ---------------------------------------------------------------------------------//
public Long getNextLevel ()
// ---------------------------------------------------------------------------------//
{
return stats.nextLevel;
}
// this is temporary until I have more data
// ---------------------------------------------------------------------------------//
public String isWinner ()
// ---------------------------------------------------------------------------------//
{
int v1 = buffer[206];
int v2 = buffer[207];
@ -221,53 +241,73 @@ class Character extends AbstractFile
return "Unknown : " + v1 + " " + v2;
}
// ---------------------------------------------------------------------------------//
public boolean isOut ()
// ---------------------------------------------------------------------------------//
{
return (buffer[32] == 1);
}
// ---------------------------------------------------------------------------------//
public String getType ()
// ---------------------------------------------------------------------------------//
{
return stats.type;
}
// ---------------------------------------------------------------------------------//
public String getRace ()
// ---------------------------------------------------------------------------------//
{
return stats.race;
}
// ---------------------------------------------------------------------------------//
public String getAlignment ()
// ---------------------------------------------------------------------------------//
{
return stats.alignment;
}
// ---------------------------------------------------------------------------------//
public Attributes getAttributes ()
// ---------------------------------------------------------------------------------//
{
return attributes;
}
// ---------------------------------------------------------------------------------//
public Statistics getStatistics ()
// ---------------------------------------------------------------------------------//
{
return stats;
}
// ---------------------------------------------------------------------------------//
public Iterator<Baggage> getBaggage ()
// ---------------------------------------------------------------------------------//
{
return baggageList.iterator ();
}
// ---------------------------------------------------------------------------------//
public Iterator<Spell> getSpells ()
// ---------------------------------------------------------------------------------//
{
return spellBook.iterator ();
}
// ---------------------------------------------------------------------------------//
@Override
public String toString ()
// ---------------------------------------------------------------------------------//
{
return name;
}
// ---------------------------------------------------------------------------------//
public class Baggage
// ---------------------------------------------------------------------------------//
{
public Item item;
public boolean equipped;
@ -288,7 +328,9 @@ class Character extends AbstractFile
}
}
// ---------------------------------------------------------------------------------//
public class Statistics implements Cloneable
// ---------------------------------------------------------------------------------//
{
public String race;
public String type;

View File

@ -2,17 +2,23 @@ package com.bytezone.diskbrowser.wizardry;
import com.bytezone.diskbrowser.utilities.HexFormatter;
// -----------------------------------------------------------------------------------//
class CodedMessage extends Message
// -----------------------------------------------------------------------------------//
{
public static int codeOffset = 185;
public CodedMessage (byte[] buffer)
// ---------------------------------------------------------------------------------//
CodedMessage (byte[] buffer)
// ---------------------------------------------------------------------------------//
{
super (buffer);
}
// ---------------------------------------------------------------------------------//
@Override
protected String getLine (int offset)
// ---------------------------------------------------------------------------------//
{
int length = buffer[offset] & 0xFF;
byte[] translation = new byte[length];

View File

@ -1,20 +1,26 @@
package com.bytezone.diskbrowser.wizardry;
// -----------------------------------------------------------------------------------//
class Dice
// -----------------------------------------------------------------------------------//
{
int qty;
int sides;
int bonus;
public Dice (byte[] buffer, int offset)
// ---------------------------------------------------------------------------------//
Dice (byte[] buffer, int offset)
// ---------------------------------------------------------------------------------//
{
qty = buffer[offset];
sides = buffer[offset + 2];
bonus = buffer[offset + 4];
}
// ---------------------------------------------------------------------------------//
@Override
public String toString ()
// ---------------------------------------------------------------------------------//
{
if (qty == 0)
return "";

View File

@ -2,15 +2,21 @@ package com.bytezone.diskbrowser.wizardry;
import com.bytezone.diskbrowser.applefile.AbstractFile;
public class DragonData extends AbstractFile
// -----------------------------------------------------------------------------------//
class DragonData extends AbstractFile
// -----------------------------------------------------------------------------------//
{
public DragonData (String name, byte[] buffer)
// ---------------------------------------------------------------------------------//
DragonData (String name, byte[] buffer)
// ---------------------------------------------------------------------------------//
{
super (name, buffer);
}
// ---------------------------------------------------------------------------------//
@Override
public String getText ()
// ---------------------------------------------------------------------------------//
{
return "DragonData";
}

View File

@ -3,11 +3,15 @@ package com.bytezone.diskbrowser.wizardry;
import com.bytezone.diskbrowser.applefile.AbstractFile;
import com.bytezone.diskbrowser.utilities.HexFormatter;
// -----------------------------------------------------------------------------------//
class ExperienceLevel extends AbstractFile
// -----------------------------------------------------------------------------------//
{
private final long[] expLevels = new long[13];
public ExperienceLevel (String name, byte[] buffer)
// ---------------------------------------------------------------------------------//
ExperienceLevel (String name, byte[] buffer)
// ---------------------------------------------------------------------------------//
{
super (name, buffer);
@ -18,23 +22,26 @@ class ExperienceLevel extends AbstractFile
if (buffer[ptr] == 0)
break;
long points =
HexFormatter.intValue (buffer[ptr], buffer[ptr + 1])
long points = HexFormatter.intValue (buffer[ptr], buffer[ptr + 1])
+ HexFormatter.intValue (buffer[ptr + 2], buffer[ptr + 3]) * 10000
+ HexFormatter.intValue (buffer[ptr + 4], buffer[ptr + 5]) * 100000000L;
expLevels[seq++] = points;
}
}
public long getExperiencePoints (int level)
// ---------------------------------------------------------------------------------//
long getExperiencePoints (int level)
// ---------------------------------------------------------------------------------//
{
if (level < 13)
return expLevels[level];
return (level - 12) * expLevels[0] + expLevels[12];
}
// ---------------------------------------------------------------------------------//
@Override
public String getText ()
// ---------------------------------------------------------------------------------//
{
StringBuilder line = new StringBuilder ();
for (long exp : expLevels)

View File

@ -12,7 +12,9 @@ import com.bytezone.diskbrowser.disk.DiskAddress;
import com.bytezone.diskbrowser.disk.FormattedDisk;
import com.bytezone.diskbrowser.utilities.HexFormatter;
// -----------------------------------------------------------------------------------//
class Header
// -----------------------------------------------------------------------------------//
{
static String[] typeText = { "header", "maze", "monsters", "rewards", "items",
"characters", "images", "char levels" };
@ -33,7 +35,9 @@ class Header
List<ScenarioData> data = new ArrayList<> (8);
FormattedDisk owner;
public Header (DefaultMutableTreeNode dataNode, FormattedDisk owner)
// ---------------------------------------------------------------------------------//
Header (DefaultMutableTreeNode dataNode, FormattedDisk owner)
// ---------------------------------------------------------------------------------//
{
this.owner = owner;
@ -98,7 +102,9 @@ class Header
}
}
// ---------------------------------------------------------------------------------//
private void linkText (String title, DiskAddress da, DefaultMutableTreeNode headerNode)
// ---------------------------------------------------------------------------------//
{
List<DiskAddress> blocks = new ArrayList<> ();
blocks.add (da);
@ -129,8 +135,10 @@ class Header
headerNode.add (node);
}
// ---------------------------------------------------------------------------------//
private void linkPictures (String title, DiskAddress da,
DefaultMutableTreeNode headerNode)
// ---------------------------------------------------------------------------------//
{
List<DiskAddress> blocks = new ArrayList<> ();
blocks.add (da);
@ -145,8 +153,10 @@ class Header
headerNode.add (node);
}
// ---------------------------------------------------------------------------------//
private void linkSpells (String title, DiskAddress da,
DefaultMutableTreeNode headerNode)
// ---------------------------------------------------------------------------------//
{
List<DiskAddress> blocks = new ArrayList<> ();
blocks.add (da);
@ -177,7 +187,9 @@ class Header
headerNode.add (node);
}
// ---------------------------------------------------------------------------------//
private String printChars (byte[] buffer, int block)
// ---------------------------------------------------------------------------------//
{
StringBuilder text = new StringBuilder ();
for (int i = block * 512; i < (block + 1) * 512; i += 64)
@ -205,7 +217,9 @@ class Header
}
// this could be the base factory class for all Wizardry types
// ---------------------------------------------------------------------------------//
class ScenarioData
// ---------------------------------------------------------------------------------//
{
int dunno;
int total;

View File

@ -7,7 +7,9 @@ import com.bytezone.diskbrowser.applefile.AbstractFile;
// link for possible display algorithm:
// http://stackoverflow.com/questions/14184655/set-position-for-drawing-binary-tree
public class Huffman extends AbstractFile
// -----------------------------------------------------------------------------------//
class Huffman extends AbstractFile
// -----------------------------------------------------------------------------------//
{
private static final byte[] mask = { 2, 1 }; // bits: 10 or 01
private static final int[] offset = { 512, 256 }; // offset to left/right nodes
@ -19,12 +21,16 @@ public class Huffman extends AbstractFile
private String bufferContents;
public Huffman (String name, byte[] buffer)
// ---------------------------------------------------------------------------------//
Huffman (String name, byte[] buffer)
// ---------------------------------------------------------------------------------//
{
super (name, buffer);
}
public String decodeMessage (byte[] message)
// ---------------------------------------------------------------------------------//
String decodeMessage (byte[] message)
// ---------------------------------------------------------------------------------//
{
this.message = message;
depth = 0;
@ -39,7 +45,9 @@ public class Huffman extends AbstractFile
return text.toString ();
}
// ---------------------------------------------------------------------------------//
private byte getChar ()
// ---------------------------------------------------------------------------------//
{
int treePtr = 0; // start at the root
@ -63,8 +71,10 @@ public class Huffman extends AbstractFile
}
}
// ---------------------------------------------------------------------------------//
@Override
public String getText ()
// ---------------------------------------------------------------------------------//
{
if (bufferContents == null)
{
@ -75,7 +85,9 @@ public class Huffman extends AbstractFile
return bufferContents;
}
// ---------------------------------------------------------------------------------//
private void walk (int treePtr, String path, StringBuilder text)
// ---------------------------------------------------------------------------------//
{
for (int currentBit = 1; currentBit >= 0; --currentBit)
if ((buffer[treePtr] & mask[currentBit]) == 0)

View File

@ -3,9 +3,13 @@ package com.bytezone.diskbrowser.wizardry;
import java.awt.image.BufferedImage;
import java.awt.image.DataBuffer;
// -----------------------------------------------------------------------------------//
class Image extends AbstractImage
// -----------------------------------------------------------------------------------//
{
public Image (String name, byte[] buffer)
// ---------------------------------------------------------------------------------//
Image (String name, byte[] buffer)
// ---------------------------------------------------------------------------------//
{
super (name, buffer);
@ -34,7 +38,9 @@ class Image extends AbstractImage
}
}
// ---------------------------------------------------------------------------------//
private void fixSlime (byte[] buffer)
// ---------------------------------------------------------------------------------//
{
for (int i = 0; i < 208; i++)
buffer[i] = 0;

View File

@ -3,9 +3,13 @@ package com.bytezone.diskbrowser.wizardry;
import java.awt.image.BufferedImage;
import java.awt.image.DataBuffer;
// -----------------------------------------------------------------------------------//
class ImageV2 extends AbstractImage
// -----------------------------------------------------------------------------------//
{
public ImageV2 (String name, byte[] buffer)
// ---------------------------------------------------------------------------------//
ImageV2 (String name, byte[] buffer)
// ---------------------------------------------------------------------------------//
{
super (name, buffer);

View File

@ -3,7 +3,9 @@ package com.bytezone.diskbrowser.wizardry;
import com.bytezone.diskbrowser.applefile.AbstractFile;
import com.bytezone.diskbrowser.utilities.HexFormatter;
// -----------------------------------------------------------------------------------//
class Item extends AbstractFile implements Comparable<Item>
// -----------------------------------------------------------------------------------//
{
public final int itemID;
private final int type;
@ -15,7 +17,9 @@ class Item extends AbstractFile implements Comparable<Item>
public final int armourClass;
public final int speed;
public Item (String name, byte[] buffer)
// ---------------------------------------------------------------------------------//
Item (String name, byte[] buffer)
// ---------------------------------------------------------------------------------//
{
super (name, buffer);
itemID = counter++;
@ -29,8 +33,10 @@ class Item extends AbstractFile implements Comparable<Item>
speed = buffer[72];
}
// ---------------------------------------------------------------------------------//
@Override
public String getText ()
// ---------------------------------------------------------------------------------//
{
StringBuilder text = new StringBuilder ();
@ -51,7 +57,9 @@ class Item extends AbstractFile implements Comparable<Item>
return text.toString ();
}
// ---------------------------------------------------------------------------------//
public int getType ()
// ---------------------------------------------------------------------------------//
{
return type;
}
@ -66,17 +74,23 @@ class Item extends AbstractFile implements Comparable<Item>
// return HexFormatter.intValue (buffer[72]);
// }
// ---------------------------------------------------------------------------------//
public long getCost ()
// ---------------------------------------------------------------------------------//
{
return cost;
}
// ---------------------------------------------------------------------------------//
public boolean isCursed ()
// ---------------------------------------------------------------------------------//
{
return buffer[36] != 0;
}
// ---------------------------------------------------------------------------------//
public int getStockOnHand ()
// ---------------------------------------------------------------------------------//
{
if (buffer[50] == -1 && buffer[51] == -1)
return -1;
@ -84,14 +98,18 @@ class Item extends AbstractFile implements Comparable<Item>
return HexFormatter.intValue (buffer[50], buffer[51]);
}
// ---------------------------------------------------------------------------------//
public boolean canUse (int type2)
// ---------------------------------------------------------------------------------//
{
int users = buffer[54] & 0xFF;
return ((users >>> type2) & 1) == 1;
}
// ---------------------------------------------------------------------------------//
@Override
public String toString ()
// ---------------------------------------------------------------------------------//
{
StringBuilder line = new StringBuilder ();
line.append (String.format ("%-16s", name));
@ -120,7 +138,9 @@ class Item extends AbstractFile implements Comparable<Item>
return line.toString ();
}
// ---------------------------------------------------------------------------------//
public String getDump (int block)
// ---------------------------------------------------------------------------------//
{
StringBuilder line = new StringBuilder (String.format ("%3d %-16s", itemID, name));
int lo = block == 0 ? 32 : block == 1 ? 46 : 70;
@ -132,8 +152,10 @@ class Item extends AbstractFile implements Comparable<Item>
return line.toString ();
}
// ---------------------------------------------------------------------------------//
@Override
public int compareTo (Item otherItem)
// ---------------------------------------------------------------------------------//
{
Item item = otherItem;
return this.type - item.type;

View File

@ -1,20 +1,26 @@
package com.bytezone.diskbrowser.wizardry;
// -----------------------------------------------------------------------------------//
class MazeAddress
// -----------------------------------------------------------------------------------//
{
public final int level;
public final int row;
public final int column;
public MazeAddress (int level, int row, int column)
// ---------------------------------------------------------------------------------//
MazeAddress (int level, int row, int column)
// ---------------------------------------------------------------------------------//
{
this.level = level;
this.row = row;
this.column = column;
}
// ---------------------------------------------------------------------------------//
@Override
public String toString ()
// ---------------------------------------------------------------------------------//
{
return level + "/" + row + "/" + column;
}

View File

@ -7,7 +7,9 @@ import java.util.List;
import com.bytezone.diskbrowser.utilities.HexFormatter;
// -----------------------------------------------------------------------------------//
class MazeCell
// -----------------------------------------------------------------------------------//
{
static Dimension cellSize = new Dimension (22, 22); // size in pixels
@ -50,12 +52,16 @@ class MazeCell
public Item itemRequired;
public Item itemObtained;
public MazeCell (MazeAddress address)
// ---------------------------------------------------------------------------------//
MazeCell (MazeAddress address)
// ---------------------------------------------------------------------------------//
{
this.address = address;
}
public void draw (Graphics2D g, int x, int y)
// ---------------------------------------------------------------------------------//
void draw (Graphics2D g, int x, int y)
// ---------------------------------------------------------------------------------//
{
g.setColor (Color.BLACK);
g.fillRect (x, y, 22, 22);
@ -127,29 +133,39 @@ class MazeCell
drawChar (g, x, y, HexFormatter.format1 (unknown), Color.GRAY);
}
public void drawWest (Graphics2D g, int x, int y)
// ---------------------------------------------------------------------------------//
void drawWest (Graphics2D g, int x, int y)
// ---------------------------------------------------------------------------------//
{
g.drawLine (x + 1, y + 1, x + 1, y + cellSize.height - 1);
}
private void drawEast (Graphics2D g, int x, int y)
// ---------------------------------------------------------------------------------//
void drawEast (Graphics2D g, int x, int y)
// ---------------------------------------------------------------------------------//
{
g.drawLine (x + cellSize.width - 1, y + 1, x + cellSize.width - 1,
y + cellSize.height - 1);
}
private void drawNorth (Graphics2D g, int x, int y)
// ---------------------------------------------------------------------------------//
void drawNorth (Graphics2D g, int x, int y)
// ---------------------------------------------------------------------------------//
{
g.drawLine (x + 1, y + 1, x + cellSize.width - 1, y + 1);
}
private void drawSouth (Graphics2D g, int x, int y)
// ---------------------------------------------------------------------------------//
void drawSouth (Graphics2D g, int x, int y)
// ---------------------------------------------------------------------------------//
{
g.drawLine (x + 1, y + cellSize.height - 1, x + cellSize.width - 1,
y + cellSize.height - 1);
}
public void drawStairsUp (Graphics2D g, int x, int y)
// ---------------------------------------------------------------------------------//
void drawStairsUp (Graphics2D g, int x, int y)
// ---------------------------------------------------------------------------------//
{
g.drawLine (x + 6, y + 18, x + 6, y + 14);
g.drawLine (x + 6, y + 14, x + 10, y + 14);
@ -159,7 +175,9 @@ class MazeCell
g.drawLine (x + 14, y + 6, x + 18, y + 6);
}
public void drawStairsDown (Graphics2D g, int x, int y)
// ---------------------------------------------------------------------------------//
void drawStairsDown (Graphics2D g, int x, int y)
// ---------------------------------------------------------------------------------//
{
g.drawLine (x + 4, y + 7, x + 8, y + 7);
g.drawLine (x + 8, y + 7, x + 8, y + 11);
@ -169,20 +187,26 @@ class MazeCell
g.drawLine (x + 16, y + 15, x + 16, y + 19);
}
public void drawPit (Graphics2D g, int x, int y)
// ---------------------------------------------------------------------------------//
void drawPit (Graphics2D g, int x, int y)
// ---------------------------------------------------------------------------------//
{
g.drawLine (x + 5, y + 14, x + 5, y + 19);
g.drawLine (x + 5, y + 19, x + 17, y + 19);
g.drawLine (x + 17, y + 14, x + 17, y + 19);
}
public void drawChute (Graphics2D g, int x, int y)
// ---------------------------------------------------------------------------------//
void drawChute (Graphics2D g, int x, int y)
// ---------------------------------------------------------------------------------//
{
g.drawLine (x + 6, y + 6, x + 10, y + 6);
g.drawLine (x + 10, y + 6, x + 18, y + 18);
}
public void drawElevator (Graphics2D g, int x, int y, int rows)
// ---------------------------------------------------------------------------------//
void drawElevator (Graphics2D g, int x, int y, int rows)
// ---------------------------------------------------------------------------------//
{
for (int i = 0; i < rows; i++)
{
@ -191,35 +215,45 @@ class MazeCell
}
}
public void drawMonsterLair (Graphics2D g, int x, int y)
// ---------------------------------------------------------------------------------//
void drawMonsterLair (Graphics2D g, int x, int y)
// ---------------------------------------------------------------------------------//
{
g.setColor (Color.YELLOW);
g.fillOval (x + 4, y + 4, 2, 2);
g.setColor (Color.WHITE);
}
public void drawTeleport (Graphics2D g, int x, int y)
// ---------------------------------------------------------------------------------//
void drawTeleport (Graphics2D g, int x, int y)
// ---------------------------------------------------------------------------------//
{
g.setColor (Color.GREEN);
g.fillOval (x + 8, y + 8, 8, 8);
g.setColor (Color.WHITE);
}
public void drawSpellsBlocked (Graphics2D g, int x, int y)
// ---------------------------------------------------------------------------------//
void drawSpellsBlocked (Graphics2D g, int x, int y)
// ---------------------------------------------------------------------------------//
{
g.setColor (Color.YELLOW);
g.fillOval (x + 8, y + 8, 8, 8);
g.setColor (Color.WHITE);
}
public void drawMonster (Graphics2D g, int x, int y)
// ---------------------------------------------------------------------------------//
void drawMonster (Graphics2D g, int x, int y)
// ---------------------------------------------------------------------------------//
{
g.setColor (Color.RED);
g.fillOval (x + 8, y + 8, 8, 8);
g.setColor (Color.WHITE);
}
public void drawDarkness (Graphics2D g, int x, int y)
// ---------------------------------------------------------------------------------//
void drawDarkness (Graphics2D g, int x, int y)
// ---------------------------------------------------------------------------------//
{
g.setColor (Color.gray);
for (int h = 0; h < 15; h += 7)
@ -228,14 +262,18 @@ class MazeCell
g.setColor (Color.white);
}
public void drawRock (Graphics2D g, int x, int y)
// ---------------------------------------------------------------------------------//
void drawRock (Graphics2D g, int x, int y)
// ---------------------------------------------------------------------------------//
{
for (int h = 0; h < 15; h += 7)
for (int offset = 0; offset < 15; offset += 7)
g.drawOval (x + offset + 4, y + h + 4, 1, 1);
}
public void drawChar (Graphics2D g, int x, int y, String c, Color colour)
// ---------------------------------------------------------------------------------//
void drawChar (Graphics2D g, int x, int y, String c, Color colour)
// ---------------------------------------------------------------------------------//
{
g.setColor (colour);
g.fillRect (x + 7, y + 6, 11, 11);
@ -243,7 +281,9 @@ class MazeCell
g.drawString (c, x + 8, y + 16);
}
public void drawHotDogStand (Graphics2D g, int x, int y)
// ---------------------------------------------------------------------------------//
void drawHotDogStand (Graphics2D g, int x, int y)
// ---------------------------------------------------------------------------------//
{
g.drawRect (x + 5, y + 11, 12, 6);
g.drawOval (x + 6, y + 18, 3, 3);
@ -253,7 +293,9 @@ class MazeCell
g.drawLine (x + 5, y + 5, x + 17, y + 5);
}
public String getTooltipText ()
// ---------------------------------------------------------------------------------//
String getTooltipText ()
// ---------------------------------------------------------------------------------//
{
StringBuilder sign = new StringBuilder ("<html><pre>");
sign.append ("&nbsp;<b>");

View File

@ -12,7 +12,9 @@ import com.bytezone.common.Utility;
import com.bytezone.diskbrowser.applefile.AbstractFile;
import com.bytezone.diskbrowser.utilities.HexFormatter;
public class MazeGridV5 extends AbstractFile
// -----------------------------------------------------------------------------------//
class MazeGridV5 extends AbstractFile
// -----------------------------------------------------------------------------------//
{
private final MessageBlock messageBlock;
List<MazeGrid> grids = new ArrayList<> ();
@ -21,7 +23,9 @@ public class MazeGridV5 extends AbstractFile
int maxX = 0;
int maxY = 0;
public MazeGridV5 (String name, byte[] buffer, MessageBlock messageBlock)
// ---------------------------------------------------------------------------------//
MazeGridV5 (String name, byte[] buffer, MessageBlock messageBlock)
// ---------------------------------------------------------------------------------//
{
super (name, buffer);
@ -45,8 +49,10 @@ public class MazeGridV5 extends AbstractFile
}
}
// ---------------------------------------------------------------------------------//
@Override
public BufferedImage getImage ()
// ---------------------------------------------------------------------------------//
{
Dimension cellSize = new Dimension (22, 22);
int fudge = 30;
@ -80,7 +86,9 @@ public class MazeGridV5 extends AbstractFile
return image;
}
// ---------------------------------------------------------------------------------//
private MazeCell getLayout (int gridNo, int row, int column)
// ---------------------------------------------------------------------------------//
{
MazeAddress address = new MazeAddress (0, row, column);
MazeCell cell = new MazeCell (address);
@ -103,8 +111,10 @@ public class MazeGridV5 extends AbstractFile
return cell;
}
// ---------------------------------------------------------------------------------//
@Override
public String getHexDump ()
// ---------------------------------------------------------------------------------//
{
StringBuilder text = new StringBuilder (super.getHexDump ());
@ -187,7 +197,9 @@ public class MazeGridV5 extends AbstractFile
return text.toString ();
}
// ---------------------------------------------------------------------------------//
private class MazeGrid
// ---------------------------------------------------------------------------------//
{
MazeCell[][] grid;
int xOffset;

View File

@ -10,21 +10,27 @@ import java.util.List;
import com.bytezone.diskbrowser.applefile.AbstractFile;
import com.bytezone.diskbrowser.utilities.HexFormatter;
// -----------------------------------------------------------------------------------//
class MazeLevel extends AbstractFile
// -----------------------------------------------------------------------------------//
{
public final int level;
private List<Message> messages;
private List<Monster> monsters;
private List<Item> items;
// ---------------------------------------------------------------------------------//
public MazeLevel (byte[] buffer, int level)
// ---------------------------------------------------------------------------------//
{
super ("Level " + level, buffer);
this.level = level;
}
// ---------------------------------------------------------------------------------//
@Override
public String getHexDump ()
// ---------------------------------------------------------------------------------//
{
StringBuilder text = new StringBuilder ();
@ -149,7 +155,9 @@ class MazeLevel extends AbstractFile
return text.toString ();
}
// ---------------------------------------------------------------------------------//
private void addWalls (StringBuilder text, int ptr)
// ---------------------------------------------------------------------------------//
{
text.append ("\n\n");
for (int i = 0; i < 20; i++)
@ -157,7 +165,9 @@ class MazeLevel extends AbstractFile
HexFormatter.getHexString (buffer, ptr + i * 6, 6)));
}
// ---------------------------------------------------------------------------------//
private void addEncounters (StringBuilder text, int ptr)
// ---------------------------------------------------------------------------------//
{
text.append ("\n\n");
for (int i = 0; i < 20; i++)
@ -185,7 +195,9 @@ class MazeLevel extends AbstractFile
}
}
// ---------------------------------------------------------------------------------//
private void addExtras (StringBuilder text, int ptr)
// ---------------------------------------------------------------------------------//
{
text.append ("\n\n");
for (int i = 0; i < 20; i++)
@ -202,8 +214,10 @@ class MazeLevel extends AbstractFile
}
}
// ---------------------------------------------------------------------------------//
@Override
public BufferedImage getImage ()
// ---------------------------------------------------------------------------------//
{
Dimension cellSize = new Dimension (22, 22);
image = new BufferedImage (20 * cellSize.width + 1, 20 * cellSize.height + 1,
@ -223,22 +237,30 @@ class MazeLevel extends AbstractFile
return image;
}
// ---------------------------------------------------------------------------------//
public void setMessages (List<Message> messages)
// ---------------------------------------------------------------------------------//
{
this.messages = messages;
}
// ---------------------------------------------------------------------------------//
public void setMonsters (List<Monster> monsters)
// ---------------------------------------------------------------------------------//
{
this.monsters = monsters;
}
// ---------------------------------------------------------------------------------//
public void setItems (List<Item> items)
// ---------------------------------------------------------------------------------//
{
this.items = items;
}
// ---------------------------------------------------------------------------------//
public MazeCell getLocation (int row, int column)
// ---------------------------------------------------------------------------------//
{
MazeAddress address = new MazeAddress (level, row, column);
MazeCell cell = new MazeCell (address);
@ -411,7 +433,9 @@ class MazeLevel extends AbstractFile
return cell;
}
// ---------------------------------------------------------------------------------//
private MazeAddress getAddress (int b) // 0:F
// ---------------------------------------------------------------------------------//
{
int x = b * 2;
return new MazeAddress (HexFormatter.intValue (buffer[768 + x], buffer[769 + x]),
@ -419,7 +443,9 @@ class MazeLevel extends AbstractFile
HexFormatter.intValue (buffer[832 + x], buffer[833 + x]));
}
// ---------------------------------------------------------------------------------//
private Message getMessage (int messageNo)
// ---------------------------------------------------------------------------------//
{
if (messages == null)
return null;
@ -431,7 +457,9 @@ class MazeLevel extends AbstractFile
return null;
}
// ---------------------------------------------------------------------------------//
private Monster getMonster (int monsterNo)
// ---------------------------------------------------------------------------------//
{
if (monsters == null)
return null;
@ -443,12 +471,16 @@ class MazeLevel extends AbstractFile
return null;
}
// ---------------------------------------------------------------------------------//
public int getRows ()
// ---------------------------------------------------------------------------------//
{
return 20;
}
// ---------------------------------------------------------------------------------//
public int getColumns ()
// ---------------------------------------------------------------------------------//
{
return 20;
}

View File

@ -5,7 +5,9 @@ import java.util.List;
import com.bytezone.diskbrowser.applefile.AbstractFile;
// -----------------------------------------------------------------------------------//
abstract class Message extends AbstractFile
// -----------------------------------------------------------------------------------//
{
private static int nextId = 0;
protected String message;
@ -13,7 +15,9 @@ abstract class Message extends AbstractFile
private int totalLines;
List<String> lines = new ArrayList<> ();
public Message (byte[] buffer)
// ---------------------------------------------------------------------------------//
Message (byte[] buffer)
// ---------------------------------------------------------------------------------//
{
super ("Message " + nextId, buffer);
this.id = nextId;
@ -33,9 +37,13 @@ abstract class Message extends AbstractFile
message = text.toString ();
}
// ---------------------------------------------------------------------------------//
protected abstract String getLine (int offset);
// ---------------------------------------------------------------------------------//
// ---------------------------------------------------------------------------------//
public boolean match (int messageNum)
// ---------------------------------------------------------------------------------//
{
if (id == messageNum)
return true;
@ -47,13 +55,17 @@ abstract class Message extends AbstractFile
return false;
}
// ---------------------------------------------------------------------------------//
@Override
public String getText ()
// ---------------------------------------------------------------------------------//
{
return message;
}
// ---------------------------------------------------------------------------------//
public String toHTMLString ()
// ---------------------------------------------------------------------------------//
{
StringBuilder message = new StringBuilder ();
for (String line : lines)
@ -64,7 +76,9 @@ abstract class Message extends AbstractFile
return message.toString ();
}
// ---------------------------------------------------------------------------------//
public static void resetMessageId ()
// ---------------------------------------------------------------------------------//
{
nextId = 0;
}

View File

@ -7,7 +7,9 @@ import java.util.List;
import com.bytezone.common.Utility;
import com.bytezone.diskbrowser.applefile.AbstractFile;
public class MessageBlock extends AbstractFile implements Iterable<MessageDataBlock>
// -----------------------------------------------------------------------------------//
class MessageBlock extends AbstractFile implements Iterable<MessageDataBlock>
// -----------------------------------------------------------------------------------//
{
private final int indexOffset;
private final int indexLength;
@ -15,7 +17,9 @@ public class MessageBlock extends AbstractFile implements Iterable<MessageDataBl
private final List<MessageDataBlock> messageDataBlocks = new ArrayList<> ();
public MessageBlock (byte[] buffer, Huffman huffman)
// ---------------------------------------------------------------------------------//
MessageBlock (byte[] buffer, Huffman huffman)
// ---------------------------------------------------------------------------------//
{
super ("bollocks", buffer);
@ -35,7 +39,9 @@ public class MessageBlock extends AbstractFile implements Iterable<MessageDataBl
}
}
// ---------------------------------------------------------------------------------//
public String getMessageText (int messageNo)
// ---------------------------------------------------------------------------------//
{
for (int i = 0; i < messageDataBlocks.size (); i++)
{
@ -46,7 +52,9 @@ public class MessageBlock extends AbstractFile implements Iterable<MessageDataBl
return null;
}
// ---------------------------------------------------------------------------------//
public List<String> getMessageLines (int messageNo)
// ---------------------------------------------------------------------------------//
{
List<String> lines = new ArrayList<> ();
@ -72,7 +80,9 @@ public class MessageBlock extends AbstractFile implements Iterable<MessageDataBl
return lines;
}
// ---------------------------------------------------------------------------------//
public byte[] getMessage (int messageNo)
// ---------------------------------------------------------------------------------//
{
for (int i = 0; i < messageDataBlocks.size (); i++)
{
@ -83,8 +93,10 @@ public class MessageBlock extends AbstractFile implements Iterable<MessageDataBl
return null;
}
// ---------------------------------------------------------------------------------//
@Override
public String getText ()
// ---------------------------------------------------------------------------------//
{
if (text != null)
return text;
@ -102,8 +114,10 @@ public class MessageBlock extends AbstractFile implements Iterable<MessageDataBl
return this.text;
}
// ---------------------------------------------------------------------------------//
@Override
public Iterator<MessageDataBlock> iterator ()
// ---------------------------------------------------------------------------------//
{
return messageDataBlocks.iterator ();
}

View File

@ -6,7 +6,9 @@ import java.util.List;
import com.bytezone.common.Utility;
import com.bytezone.diskbrowser.applefile.AbstractFile;
public class MessageDataBlock extends AbstractFile
// -----------------------------------------------------------------------------------//
class MessageDataBlock extends AbstractFile
// -----------------------------------------------------------------------------------//
{
final int firstMessageNo;
final int lastMessageNo;
@ -16,8 +18,9 @@ public class MessageDataBlock extends AbstractFile
private final Huffman huffman;
public MessageDataBlock (String name, byte[] buffer, int firstMessageNo,
Huffman huffman)
// ---------------------------------------------------------------------------------//
MessageDataBlock (String name, byte[] buffer, int firstMessageNo, Huffman huffman)
// ---------------------------------------------------------------------------------//
{
super (name, buffer);
@ -75,7 +78,9 @@ public class MessageDataBlock extends AbstractFile
this.name += " - " + lastMessageNo;
}
// ---------------------------------------------------------------------------------//
byte[] getMessage (int messageNo)
// ---------------------------------------------------------------------------------//
{
for (Message message : messages)
if (message.msgNo == messageNo)
@ -87,7 +92,9 @@ public class MessageDataBlock extends AbstractFile
return null;
}
// ---------------------------------------------------------------------------------//
String getText (int messageNo)
// ---------------------------------------------------------------------------------//
{
for (Message message : messages)
if (message.msgNo == messageNo)
@ -99,8 +106,10 @@ public class MessageDataBlock extends AbstractFile
return null;
}
// ---------------------------------------------------------------------------------//
@Override
public String getText ()
// ---------------------------------------------------------------------------------//
{
if (messages.size () == 0)
return "No Messages";
@ -128,8 +137,10 @@ public class MessageDataBlock extends AbstractFile
return text.toString ();
}
// ---------------------------------------------------------------------------------//
@Override
public String toString ()
// ---------------------------------------------------------------------------------//
{
StringBuilder text = new StringBuilder ();
@ -145,7 +156,9 @@ public class MessageDataBlock extends AbstractFile
return text.toString ();
}
// ---------------------------------------------------------------------------------//
class Message
// ---------------------------------------------------------------------------------//
{
final int msgNo;
final int offset;

View File

@ -7,7 +7,9 @@ import java.util.List;
import com.bytezone.diskbrowser.applefile.AbstractFile;
import com.bytezone.diskbrowser.utilities.HexFormatter;
// -----------------------------------------------------------------------------------//
class Monster extends AbstractFile implements Comparable<Monster>
// -----------------------------------------------------------------------------------//
{
public final String genericName;
public final String realName;
@ -65,8 +67,9 @@ class Monster extends AbstractFile implements Comparable<Monster>
2200, 1000, 1900 // 90-100
};
public Monster (String name, byte[] buffer, List<Reward> rewards,
List<Monster> monsters)
// ---------------------------------------------------------------------------------//
Monster (String name, byte[] buffer, List<Reward> rewards, List<Monster> monsters)
// ---------------------------------------------------------------------------------//
{
super (name, buffer);
@ -106,8 +109,10 @@ class Monster extends AbstractFile implements Comparable<Monster>
}
}
// ---------------------------------------------------------------------------------//
@Override
public String getText ()
// ---------------------------------------------------------------------------------//
{
StringBuilder text = new StringBuilder ();
@ -193,7 +198,9 @@ class Monster extends AbstractFile implements Comparable<Monster>
return text.toString ();
}
// ---------------------------------------------------------------------------------//
public int getExperience ()
// ---------------------------------------------------------------------------------//
{
// these values definitely affect the damage a monster does (when breathing?)
int exp2 = ((buffer[72] & 0xFF) * (buffer[74] & 0xFF) - 1) * 20;
@ -210,28 +217,38 @@ class Monster extends AbstractFile implements Comparable<Monster>
return exp2 + exp3 + exp4 + exp5 + exp6 + exp7 + exp8 + exp9 + exp10 + exp11 + exp12;
}
// ---------------------------------------------------------------------------------//
private int getBonus (int base, int value)
// ---------------------------------------------------------------------------------//
{
return base * pwr[value];
}
// ---------------------------------------------------------------------------------//
public void setImage (BufferedImage image)
// ---------------------------------------------------------------------------------//
{
this.image = image;
}
// ---------------------------------------------------------------------------------//
@Override
public String getName ()
// ---------------------------------------------------------------------------------//
{
return realName;
}
// ---------------------------------------------------------------------------------//
public String getRealName ()
// ---------------------------------------------------------------------------------//
{
return realName;
}
// ---------------------------------------------------------------------------------//
public String getDamage ()
// ---------------------------------------------------------------------------------//
{
StringBuilder text = new StringBuilder ();
for (Dice d : damage)
@ -241,7 +258,9 @@ class Monster extends AbstractFile implements Comparable<Monster>
return text.toString ();
}
// ---------------------------------------------------------------------------------//
public String getDump (int block)
// ---------------------------------------------------------------------------------//
{
StringBuilder line =
new StringBuilder (String.format ("%3d %-16s", monsterID, realName));
@ -261,13 +280,17 @@ class Monster extends AbstractFile implements Comparable<Monster>
return line.toString ();
}
// ---------------------------------------------------------------------------------//
public boolean match (int monsterID)
// ---------------------------------------------------------------------------------//
{
return this.monsterID == monsterID;
}
// ---------------------------------------------------------------------------------//
@Override
public int compareTo (Monster other) // where is this used?
// ---------------------------------------------------------------------------------//
{
if (this.type == other.type)
return 0;
@ -276,8 +299,10 @@ class Monster extends AbstractFile implements Comparable<Monster>
return 1;
}
// ---------------------------------------------------------------------------------//
@Override
public String toString ()
// ---------------------------------------------------------------------------------//
{
return realName;
}

View File

@ -2,15 +2,21 @@ package com.bytezone.diskbrowser.wizardry;
import com.bytezone.diskbrowser.utilities.HexFormatter;
// -----------------------------------------------------------------------------------//
class PlainMessage extends Message
// -----------------------------------------------------------------------------------//
{
public PlainMessage (byte[] buffer)
// ---------------------------------------------------------------------------------//
PlainMessage (byte[] buffer)
// ---------------------------------------------------------------------------------//
{
super (buffer);
}
// ---------------------------------------------------------------------------------//
@Override
protected String getLine (int offset)
// ---------------------------------------------------------------------------------//
{
int length = buffer[offset] & 0xFF;
return HexFormatter.getString (buffer, offset + 1, length);

View File

@ -9,7 +9,9 @@ import com.bytezone.diskbrowser.disk.Disk;
import com.bytezone.diskbrowser.disk.DiskAddress;
import com.bytezone.diskbrowser.utilities.HexFormatter;
// -----------------------------------------------------------------------------------//
public class Relocator extends AbstractFile
// -----------------------------------------------------------------------------------//
{
private final int checkByte;
private final List<DiskRecord> diskRecords = new ArrayList<> ();
@ -17,7 +19,9 @@ public class Relocator extends AbstractFile
private final int[] diskBlocks = new int[0x800];
private final int[] diskOffsets = new int[0x800];
// ---------------------------------------------------------------------------------//
public Relocator (String name, byte[] buffer)
// ---------------------------------------------------------------------------------//
{
super (name, buffer);
@ -37,7 +41,9 @@ public class Relocator extends AbstractFile
addLogicalBlock ((byte) diskRecord.diskNumber, diskSegment);
}
// ---------------------------------------------------------------------------------//
private void addLogicalBlock (byte disk, DiskSegment diskSegment)
// ---------------------------------------------------------------------------------//
{
int lo = diskSegment.logicalBlock;
int hi = diskSegment.logicalBlock + diskSegment.segmentLength;
@ -50,7 +56,9 @@ public class Relocator extends AbstractFile
}
}
// ---------------------------------------------------------------------------------//
public void createNewBuffer (Disk[] dataDisks)
// ---------------------------------------------------------------------------------//
{
AppleDisk master = (AppleDisk) dataDisks[0];
// byte[] key1 = { 0x55, 0x55, 0x15, 0x55 };
@ -78,8 +86,10 @@ public class Relocator extends AbstractFile
}
}
// ---------------------------------------------------------------------------------//
@Override
public String getText ()
// ---------------------------------------------------------------------------------//
{
StringBuilder text = new StringBuilder ();
@ -149,7 +159,9 @@ public class Relocator extends AbstractFile
return text.toString ();
}
// ---------------------------------------------------------------------------------//
private class DiskRecord
// ---------------------------------------------------------------------------------//
{
int diskNumber;
int totDiskSegments;
@ -202,7 +214,9 @@ public class Relocator extends AbstractFile
}
}
// ---------------------------------------------------------------------------------//
private class DiskSegment
// ---------------------------------------------------------------------------------//
{
int logicalBlock;
int physicalBlock;

View File

@ -5,7 +5,9 @@ import java.util.List;
import com.bytezone.diskbrowser.applefile.AbstractFile;
// -----------------------------------------------------------------------------------//
class Reward extends AbstractFile
// -----------------------------------------------------------------------------------//
{
static String[] types = { "gold", "item" };
static final int SEGMENT_LENGTH = 18;
@ -16,7 +18,9 @@ class Reward extends AbstractFile
List<Monster> goldMonsters = new ArrayList<> ();
List<Monster> chestMonsters = new ArrayList<> ();
public Reward (String name, byte[] buffer, int id, List<Item> items)
// ---------------------------------------------------------------------------------//
Reward (String name, byte[] buffer, int id, List<Item> items)
// ---------------------------------------------------------------------------------//
{
super (name, buffer);
this.id = id;
@ -32,7 +36,9 @@ class Reward extends AbstractFile
}
}
// ---------------------------------------------------------------------------------//
public void addMonster (Monster monster, int location)
// ---------------------------------------------------------------------------------//
{
if (location == 0)
goldMonsters.add (monster);
@ -40,13 +46,17 @@ class Reward extends AbstractFile
chestMonsters.add (monster);
}
// ---------------------------------------------------------------------------------//
@Override
public String getText ()
// ---------------------------------------------------------------------------------//
{
return getText (true);
}
// ---------------------------------------------------------------------------------//
public String getText (boolean showLinks)
// ---------------------------------------------------------------------------------//
{
StringBuilder text = new StringBuilder ();
for (RewardElement re : elements)
@ -71,7 +81,9 @@ class Reward extends AbstractFile
return text.toString ();
}
// ---------------------------------------------------------------------------------//
public String getDump ()
// ---------------------------------------------------------------------------------//
{
StringBuilder text = new StringBuilder ();
int seq = 0;
@ -84,7 +96,9 @@ class Reward extends AbstractFile
return text.toString ();
}
// ---------------------------------------------------------------------------------//
private class RewardElement
// ---------------------------------------------------------------------------------//
{
int type;
int odds;

View File

@ -2,7 +2,9 @@ package com.bytezone.diskbrowser.wizardry;
import com.bytezone.diskbrowser.applefile.AbstractFile;
// -----------------------------------------------------------------------------------//
class Spell extends AbstractFile
// -----------------------------------------------------------------------------------//
{
private final SpellType spellType;
private SpellThrown whenCast;
@ -11,27 +13,33 @@ class Spell extends AbstractFile
private SpellTarget target;
private String description;
public enum SpellType {
public enum SpellType
{
MAGE, PRIEST
};
public enum SpellTarget {
public enum SpellTarget
{
PERSON, PARTY, MONSTER, MONSTER_GROUP, ALL_MONSTERS, VARIABLE, NONE, CASTER
};
public enum SpellThrown {
public enum SpellThrown
{
COMBAT, ANY_TIME, LOOTING, CAMP, COMBAT_OR_CAMP
};
private static int lastSpellFound = -1;
// ---------------------------------------------------------------------------------//
private Spell (String spellName, SpellType type, int level, byte[] buffer)
// ---------------------------------------------------------------------------------//
{
super (spellName, buffer);
this.spellType = type;
this.level = level;
if (lastSpellFound + 1 < spellNames.length && spellName.equals (spellNames[lastSpellFound + 1]))
if (lastSpellFound + 1 < spellNames.length
&& spellName.equals (spellNames[lastSpellFound + 1]))
setSpell (++lastSpellFound);
else
{
@ -45,7 +53,9 @@ class Spell extends AbstractFile
}
}
// ---------------------------------------------------------------------------------//
private void setSpell (int spellNo)
// ---------------------------------------------------------------------------------//
{
this.translation = translations[spellNo];
this.description = descriptions[spellNo];
@ -53,38 +63,54 @@ class Spell extends AbstractFile
this.target = affects[spellNo];
}
public static Spell getSpell (String spellName, SpellType type, int level, byte[] buffer)
// ---------------------------------------------------------------------------------//
public static Spell getSpell (String spellName, SpellType type, int level,
byte[] buffer)
// ---------------------------------------------------------------------------------//
{
return new Spell (spellName, type, level, buffer);
}
// ---------------------------------------------------------------------------------//
@Override
public String getName ()
// ---------------------------------------------------------------------------------//
{
return name;
}
// ---------------------------------------------------------------------------------//
public SpellType getType ()
// ---------------------------------------------------------------------------------//
{
return spellType;
}
// ---------------------------------------------------------------------------------//
public int getLevel ()
// ---------------------------------------------------------------------------------//
{
return level;
}
// ---------------------------------------------------------------------------------//
public String getTranslation ()
// ---------------------------------------------------------------------------------//
{
return translation;
}
// ---------------------------------------------------------------------------------//
@Override
public String getText ()
// ---------------------------------------------------------------------------------//
{
return description;
}
// ---------------------------------------------------------------------------------//
public String getWhenCast ()
// ---------------------------------------------------------------------------------//
{
switch (whenCast)
{
@ -104,7 +130,9 @@ class Spell extends AbstractFile
}
// ---------------------------------------------------------------------------------//
public String getArea ()
// ---------------------------------------------------------------------------------//
{
switch (target)
{
@ -127,10 +155,11 @@ class Spell extends AbstractFile
default:
return "?";
}
}
// ---------------------------------------------------------------------------------//
public String toHTMLTable ()
// ---------------------------------------------------------------------------------//
{
StringBuilder text = new StringBuilder ("<table border=\"1\"");
text.append (" width=\"100%\">\n");
@ -157,8 +186,10 @@ class Spell extends AbstractFile
return text.toString ();
}
// ---------------------------------------------------------------------------------//
@Override
public String toString ()
// ---------------------------------------------------------------------------------//
{
StringBuilder text = new StringBuilder (name);
while (text.length () < 14)
@ -181,65 +212,67 @@ class Spell extends AbstractFile
}
private static String[] spellNames =
{ "KALKI", "DIOS", "BADIOS", "MILWA", "PORFIC", "MATU", "CALFO", "MANIFO", "MONTINO",
"LOMILWA", "DIALKO", "LATUMAPIC", "BAMATU", "DIAL", "BADIAL", "LATUMOFIS", "MAPORFIC",
"DIALMA", "BADIALMA", "LITOKAN", "KANDI", "DI", "BADI", "LORTO", "MADI", "MABADI",
"LOKTOFEIT", "MALIKTO", "KADORTO",
{ "KALKI", "DIOS", "BADIOS", "MILWA", "PORFIC", "MATU", "CALFO", "MANIFO",
"MONTINO", "LOMILWA", "DIALKO", "LATUMAPIC", "BAMATU", "DIAL", "BADIAL",
"LATUMOFIS", "MAPORFIC", "DIALMA", "BADIALMA", "LITOKAN", "KANDI", "DI", "BADI",
"LORTO", "MADI", "MABADI", "LOKTOFEIT", "MALIKTO", "KADORTO",
"HALITO", "MOGREF", "KATINO", "DUMAPIC", "DILTO", "SOPIC", "MAHALITO", "MOLITO",
"MORLIS", "DALTO", "LAHALITO", "MAMORLIS", "MAKANITO", "MADALTO", "LAKANITO", "ZILWAN",
"MASOPIC", "HAMAN", "MALOR", "MAHAMAN", "TILTOWAIT" };
"MORLIS", "DALTO", "LAHALITO", "MAMORLIS", "MAKANITO", "MADALTO", "LAKANITO",
"ZILWAN", "MASOPIC", "HAMAN", "MALOR", "MAHAMAN", "TILTOWAIT" };
private static String[] translations =
{ "Blessings", "Heal", "Harm", "Light", "Shield", "Blessing & zeal", "X-ray vision",
"Statue", "Still air", "More light", "Softness/supple", "Identification", "Prayer",
"Heal (more)", "Hurt (more)", "Cure poison", "Shield (big)", "Heal (greatly)",
"Hurt (greatly)", "Flame tower", "Location", "Life", "Death", "Blades", "Healing",
"Harm (incredibly)", "Recall", "The Word of Death", "Resurrection",
"Statue", "Still air", "More light", "Softness/supple", "Identification",
"Prayer", "Heal (more)", "Hurt (more)", "Cure poison", "Shield (big)",
"Heal (greatly)", "Hurt (greatly)", "Flame tower", "Location", "Life", "Death",
"Blades", "Healing", "Harm (incredibly)", "Recall", "The Word of Death",
"Resurrection",
"Little Fire", "Body Iron", "Bad Air", "Clarity", "Darkness", "Glass", "Big fire",
"Spark storm", "Fear", "Blizzard blast", "Flame storm", "Terror", "Deadly air", "Frost",
"Suffocation", "Dispell", "Big glass", "Change", "Apport", "Great change",
"(untranslatable)" };
"Spark storm", "Fear", "Blizzard blast", "Flame storm", "Terror", "Deadly air",
"Frost", "Suffocation", "Dispell", "Big glass", "Change", "Apport",
"Great change", "(untranslatable)" };
private static SpellThrown[] when =
{ SpellThrown.COMBAT, SpellThrown.ANY_TIME, SpellThrown.COMBAT, SpellThrown.ANY_TIME,
SpellThrown.COMBAT, SpellThrown.COMBAT, SpellThrown.LOOTING, SpellThrown.COMBAT,
SpellThrown.COMBAT, SpellThrown.ANY_TIME, SpellThrown.ANY_TIME, SpellThrown.COMBAT,
SpellThrown.COMBAT, SpellThrown.ANY_TIME, SpellThrown.COMBAT, SpellThrown.ANY_TIME,
SpellThrown.ANY_TIME, SpellThrown.ANY_TIME, SpellThrown.COMBAT, SpellThrown.COMBAT,
SpellThrown.CAMP, SpellThrown.CAMP, SpellThrown.COMBAT, SpellThrown.COMBAT,
SpellThrown.ANY_TIME, SpellThrown.COMBAT, SpellThrown.COMBAT, SpellThrown.COMBAT,
SpellThrown.ANY_TIME,
{ SpellThrown.COMBAT, SpellThrown.ANY_TIME, SpellThrown.COMBAT,
SpellThrown.ANY_TIME, SpellThrown.COMBAT, SpellThrown.COMBAT, SpellThrown.LOOTING,
SpellThrown.COMBAT, SpellThrown.COMBAT, SpellThrown.ANY_TIME,
SpellThrown.ANY_TIME, SpellThrown.COMBAT, SpellThrown.COMBAT,
SpellThrown.ANY_TIME, SpellThrown.COMBAT, SpellThrown.ANY_TIME,
SpellThrown.ANY_TIME, SpellThrown.ANY_TIME, SpellThrown.COMBAT,
SpellThrown.COMBAT, SpellThrown.CAMP, SpellThrown.CAMP, SpellThrown.COMBAT,
SpellThrown.COMBAT, SpellThrown.ANY_TIME, SpellThrown.COMBAT, SpellThrown.COMBAT,
SpellThrown.COMBAT, SpellThrown.ANY_TIME,
SpellThrown.COMBAT, SpellThrown.COMBAT, SpellThrown.COMBAT, SpellThrown.CAMP,
SpellThrown.COMBAT, SpellThrown.COMBAT, SpellThrown.COMBAT, SpellThrown.COMBAT,
SpellThrown.COMBAT, SpellThrown.COMBAT, SpellThrown.COMBAT, SpellThrown.COMBAT,
SpellThrown.COMBAT, SpellThrown.COMBAT, SpellThrown.COMBAT, SpellThrown.COMBAT,
SpellThrown.COMBAT, SpellThrown.COMBAT, SpellThrown.COMBAT_OR_CAMP, SpellThrown.COMBAT,
SpellThrown.COMBAT, };
SpellThrown.COMBAT, SpellThrown.COMBAT, SpellThrown.COMBAT_OR_CAMP,
SpellThrown.COMBAT, SpellThrown.COMBAT, };
private static SpellTarget[] affects =
{ SpellTarget.PARTY, SpellTarget.PERSON, SpellTarget.MONSTER, SpellTarget.PARTY,
SpellTarget.CASTER, SpellTarget.PARTY, SpellTarget.CASTER, SpellTarget.MONSTER_GROUP,
SpellTarget.MONSTER_GROUP, SpellTarget.PARTY, SpellTarget.PERSON, SpellTarget.PARTY,
SpellTarget.PARTY, SpellTarget.PERSON, SpellTarget.MONSTER, SpellTarget.PERSON,
SpellTarget.PARTY, SpellTarget.PERSON, SpellTarget.MONSTER, SpellTarget.PARTY,
SpellTarget.PERSON, SpellTarget.PERSON, SpellTarget.MONSTER, SpellTarget.MONSTER_GROUP,
SpellTarget.PERSON, SpellTarget.MONSTER, SpellTarget.PARTY, SpellTarget.MONSTER_GROUP,
SpellTarget.CASTER, SpellTarget.PARTY, SpellTarget.CASTER,
SpellTarget.MONSTER_GROUP, SpellTarget.MONSTER_GROUP, SpellTarget.PARTY,
SpellTarget.PERSON, SpellTarget.PARTY, SpellTarget.PARTY, SpellTarget.PERSON,
SpellTarget.MONSTER, SpellTarget.PERSON, SpellTarget.PARTY, SpellTarget.PERSON,
SpellTarget.MONSTER, SpellTarget.PARTY, SpellTarget.PERSON, SpellTarget.PERSON,
SpellTarget.MONSTER, SpellTarget.MONSTER_GROUP, SpellTarget.PERSON,
SpellTarget.MONSTER, SpellTarget.PARTY, SpellTarget.MONSTER_GROUP,
SpellTarget.PERSON,
SpellTarget.MONSTER, SpellTarget.CASTER, SpellTarget.MONSTER_GROUP, SpellTarget.NONE,
SpellTarget.MONSTER_GROUP, SpellTarget.CASTER, SpellTarget.MONSTER_GROUP,
SpellTarget.MONSTER, SpellTarget.CASTER, SpellTarget.MONSTER_GROUP,
SpellTarget.NONE, SpellTarget.MONSTER_GROUP, SpellTarget.CASTER,
SpellTarget.MONSTER_GROUP, SpellTarget.MONSTER_GROUP, SpellTarget.MONSTER_GROUP,
SpellTarget.MONSTER_GROUP, SpellTarget.ALL_MONSTERS, SpellTarget.ALL_MONSTERS,
SpellTarget.MONSTER_GROUP, SpellTarget.MONSTER_GROUP, SpellTarget.MONSTER,
SpellTarget.PARTY, SpellTarget.VARIABLE, SpellTarget.PARTY, SpellTarget.PARTY,
SpellTarget.ALL_MONSTERS };
SpellTarget.MONSTER_GROUP, SpellTarget.MONSTER_GROUP, SpellTarget.ALL_MONSTERS,
SpellTarget.ALL_MONSTERS, SpellTarget.MONSTER_GROUP, SpellTarget.MONSTER_GROUP,
SpellTarget.MONSTER, SpellTarget.PARTY, SpellTarget.VARIABLE, SpellTarget.PARTY,
SpellTarget.PARTY, SpellTarget.ALL_MONSTERS };
private static String[] descriptions =
{
"KALKI reduces the AC of all party members by one, and thus makes"
{ "KALKI reduces the AC of all party members by one, and thus makes"
+ " them harder to hit.",
"DIOS restores from one to eight hit points of damage from a party"
+ "member. It will not bring dead back to life.",
@ -273,14 +306,16 @@ class Spell extends AbstractFile
+ " combat mode.",
"DIALKO cures paralysis, and removes the effects of MANIFO and"
+ " KATINO from one member of the party.",
"LATUMAPIC makes it readily apparent exactly what the opposing" + " monsters really are.",
"LATUMAPIC makes it readily apparent exactly what the opposing"
+ " monsters really are.",
"BAMATU has the effects of MATU at twice the effectiveness.",
"DIAL restores two to 16 hit points of damage, and is similar to" + " DIOS.",
"BADIAL causes two to 16 hit points of damage in the same way as" + " BADIOS.",
"LATUMOFIS makes a poisoned person whole and fit again. Note that"
+ " poison causes a person to lose hit points steadily during"
+ " movement and combat.",
"MAPORFIC is an improved PORFIC, with effects that last for the" + " entire expedition.",
"MAPORFIC is an improved PORFIC, with effects that last for the"
+ " entire expedition.",
"DIALMA restores three to 24 hit points.",
"BADIALMA causes three to 24 hit points of damage.",
"LITOKAN causes a pillar of flame to strike a group of monsters,"
@ -297,8 +332,10 @@ class Spell extends AbstractFile
+ " not cause death to occur.",
"LORTO causes sharp blades to slice through a group, causing six to"
+ " 36 points of damage.",
"MADI causes all hit points to be restored and cures any condition" + " but death.",
"MABADI causes all but one to eight hit points to be removed from" + " the target.",
"MADI causes all hit points to be restored and cures any condition"
+ " but death.",
"MABADI causes all but one to eight hit points to be removed from"
+ " the target.",
"LOKTOFEIT causes all party members to be teleported back to the"
+ " castle, minus all their equipment and most of their gold. There"
+ " is also a good chance this spell will not function.",
@ -310,7 +347,8 @@ class Spell extends AbstractFile
"HALITO causes a flame ball the size of a baseball to hit a monster,"
+ " doing from one to eight points of damage.",
"MOGREF reduces the caster's AC by two. The effect lasts the entire" + " encounter.",
"MOGREF reduces the caster's AC by two. The effect lasts the entire"
+ " encounter.",
"KATINO causes most of the monsters in a group to fall asleep."
+ " Katino only effects normal, animal or humanoid monsters. The"
+ " chance of the spell affecting an individual monster, and the"
@ -337,7 +375,8 @@ class Spell extends AbstractFile
"DALTO is similar to MAHALITO except that cold replaces flames."
+ " Also, six to 36 hit points of damage are done.",
"LAHALITO is an improved MAHALITO, doing the same damage as DALTO.",
"MAMORLIS is similar to MORLIS, except that all monster groups are" + " affected.",
"MAMORLIS is similar to MORLIS, except that all monster groups are"
+ " affected.",
"Any monsters of less than eigth level (i.e. about 35-40 hit points)"
+ " are killed by this spell outright.",
"An improved DALTO causing eight to 64 hit points of damage.",

View File

@ -3,9 +3,13 @@ package com.bytezone.diskbrowser.wizardry;
import java.awt.image.BufferedImage;
import java.awt.image.DataBuffer;
// -----------------------------------------------------------------------------------//
public class Wiz4Image extends AbstractImage
// -----------------------------------------------------------------------------------//
{
// ---------------------------------------------------------------------------------//
public Wiz4Image (String name, byte[] buffer, int rows, int cols) // 5, 6
// ---------------------------------------------------------------------------------//
{
super (name, buffer);

View File

@ -6,12 +6,16 @@ import java.util.List;
import com.bytezone.diskbrowser.applefile.AbstractFile;
import com.bytezone.diskbrowser.utilities.HexFormatter;
// -----------------------------------------------------------------------------------//
public class Wiz4Monsters extends AbstractFile
// -----------------------------------------------------------------------------------//
{
final List<Wiz4Image> images = new ArrayList<> ();
final List<Integer> blocks = new ArrayList<> ();
// ---------------------------------------------------------------------------------//
public Wiz4Monsters (String name, byte[] buffer)
// ---------------------------------------------------------------------------------//
{
super (name, buffer);
@ -30,8 +34,10 @@ public class Wiz4Monsters extends AbstractFile
}
}
// ---------------------------------------------------------------------------------//
@Override
public String getText ()
// ---------------------------------------------------------------------------------//
{
StringBuilder text = new StringBuilder ();

View File

@ -8,12 +8,16 @@ import com.bytezone.common.Utility;
import com.bytezone.diskbrowser.applefile.AbstractFile;
import com.bytezone.diskbrowser.utilities.HexFormatter;
public class Wiz5Monsters extends AbstractFile implements Iterable<Wiz5Monsters.Monster>
// -----------------------------------------------------------------------------------//
class Wiz5Monsters extends AbstractFile implements Iterable<Wiz5Monsters.Monster>
// -----------------------------------------------------------------------------------//
{
private static final int BLOCK_SIZE = 512;
private final List<Monster> monsters = new ArrayList<> ();
public Wiz5Monsters (String name, byte[] buffer)
// ---------------------------------------------------------------------------------//
Wiz5Monsters (String name, byte[] buffer)
// ---------------------------------------------------------------------------------//
{
super (name, buffer);
@ -56,14 +60,18 @@ public class Wiz5Monsters extends AbstractFile implements Iterable<Wiz5Monsters.
}
}
// ---------------------------------------------------------------------------------//
@Override
public Iterator<Monster> iterator ()
// ---------------------------------------------------------------------------------//
{
return monsters.iterator ();
}
// ---------------------------------------------------------------------------------//
@Override
public String getText ()
// ---------------------------------------------------------------------------------//
{
StringBuilder text = new StringBuilder ();
@ -90,7 +98,9 @@ public class Wiz5Monsters extends AbstractFile implements Iterable<Wiz5Monsters.
return text.toString ();
}
// ---------------------------------------------------------------------------------//
class Monster
// ---------------------------------------------------------------------------------//
{
private final int id;
private final List<DataBuffer> dataBuffers = new ArrayList<> ();
@ -151,7 +161,9 @@ public class Wiz5Monsters extends AbstractFile implements Iterable<Wiz5Monsters.
}
}
// ---------------------------------------------------------------------------------//
class DataBuffer
// ---------------------------------------------------------------------------------//
{
private final int block;
private final int offset;

View File

@ -17,7 +17,9 @@ import com.bytezone.diskbrowser.utilities.HexFormatter;
import com.bytezone.diskbrowser.utilities.Utility;
import com.bytezone.diskbrowser.wizardry.Header.ScenarioData;
// -----------------------------------------------------------------------------------//
public class Wizardry4BootDisk extends PascalDisk
// -----------------------------------------------------------------------------------//
{
public Header scenarioHeader;
// private final List<AppleDisk> disks = new ArrayList<> ();
@ -26,7 +28,9 @@ public class Wizardry4BootDisk extends PascalDisk
private Huffman huffman;
private final int version;
// ---------------------------------------------------------------------------------//
public Wizardry4BootDisk (AppleDisk[] dataDisks)
// ---------------------------------------------------------------------------------//
{
super (dataDisks[0]);
@ -133,8 +137,10 @@ public class Wizardry4BootDisk extends PascalDisk
}
}
// ---------------------------------------------------------------------------------//
private void linkMonsterImages4 (DefaultMutableTreeNode monstersNode,
FileEntry fileEntry)
// ---------------------------------------------------------------------------------//
{
List<DiskAddress> pictureBlocks = fileEntry.getSectors ();
@ -151,8 +157,10 @@ public class Wizardry4BootDisk extends PascalDisk
}
}
// ---------------------------------------------------------------------------------//
private void linkMonsterImages5 (DefaultMutableTreeNode monstersNode,
FileEntry fileEntry)
// ---------------------------------------------------------------------------------//
{
List<DiskAddress> pictureBlocks = fileEntry.getSectors ();
@ -169,7 +177,9 @@ public class Wizardry4BootDisk extends PascalDisk
}
}
// ---------------------------------------------------------------------------------//
private void linkMazeLevels4 (DefaultMutableTreeNode scenarioNode, FileEntry fileEntry)
// ---------------------------------------------------------------------------------//
{
ScenarioData mazeData = scenarioHeader.data.get (Header.MAZE_AREA);
@ -191,7 +201,9 @@ public class Wizardry4BootDisk extends PascalDisk
}
}
// ---------------------------------------------------------------------------------//
private void linkMazeLevels5 (DefaultMutableTreeNode scenarioNode, FileEntry fileEntry)
// ---------------------------------------------------------------------------------//
{
byte[] buffer = fileEntry.getDataSource ().buffer;
List<DiskAddress> blocks = fileEntry.getSectors ();
@ -221,7 +233,9 @@ public class Wizardry4BootDisk extends PascalDisk
afs.setSectors (allMazeBlocks);
}
// ---------------------------------------------------------------------------------//
private void linkBlock1 (DefaultMutableTreeNode scenarioNode, FileEntry fileEntry)
// ---------------------------------------------------------------------------------//
{
byte[] buffer = fileEntry.getDataSource ().buffer;
List<DiskAddress> blocks = fileEntry.getSectors ();
@ -248,7 +262,9 @@ public class Wizardry4BootDisk extends PascalDisk
afs.setSectors (allBlocks);
}
// ---------------------------------------------------------------------------------//
private void linkBlock2 (DefaultMutableTreeNode scenarioNode, FileEntry fileEntry)
// ---------------------------------------------------------------------------------//
{
byte[] buffer = fileEntry.getDataSource ().buffer;
List<DiskAddress> blocks = fileEntry.getSectors ();
@ -275,7 +291,9 @@ public class Wizardry4BootDisk extends PascalDisk
afs.setSectors (allBlocks);
}
// ---------------------------------------------------------------------------------//
private void linkOracle (DefaultMutableTreeNode scenarioNode, FileEntry fileEntry)
// ---------------------------------------------------------------------------------//
{
byte[] buffer = fileEntry.getDataSource ().buffer;
List<DiskAddress> blocks = fileEntry.getSectors ();
@ -309,8 +327,10 @@ public class Wizardry4BootDisk extends PascalDisk
afs.setSectors (allOracleBlocks);
}
// ---------------------------------------------------------------------------------//
private void addToNode (AbstractFile af, DefaultMutableTreeNode node,
List<DiskAddress> blocks)
// ---------------------------------------------------------------------------------//
{
DefaultAppleFileSource dafs =
new DefaultAppleFileSource (af.getName (), af, this, blocks);
@ -319,8 +339,10 @@ public class Wizardry4BootDisk extends PascalDisk
node.add (childNode);
}
// ---------------------------------------------------------------------------------//
private DefaultMutableTreeNode linkNode (String name, String text,
DefaultMutableTreeNode parent)
// ---------------------------------------------------------------------------------//
{
DefaultAppleFileSource afs = new DefaultAppleFileSource (name, text, this);
DefaultMutableTreeNode node = new DefaultMutableTreeNode (afs);
@ -328,7 +350,9 @@ public class Wizardry4BootDisk extends PascalDisk
return node;
}
// ---------------------------------------------------------------------------------//
public static boolean isWizardryIVorV (Disk disk, boolean debug)
// ---------------------------------------------------------------------------------//
{
// Wizardry IV or V boot code
byte[] header = { 0x00, (byte) 0xEA, (byte) 0xA9, 0x60, (byte) 0x8D, 0x01, 0x08 };

View File

@ -22,7 +22,9 @@ import com.bytezone.diskbrowser.wizardry.Character.Statistics;
import com.bytezone.diskbrowser.wizardry.Header.ScenarioData;
import com.bytezone.diskbrowser.wizardry.Spell.SpellType;
// ---------------------------------------------------------------------------------//
public class WizardryScenarioDisk extends PascalDisk
// ---------------------------------------------------------------------------------//
{
public Header scenarioHeader;
@ -47,7 +49,9 @@ public class WizardryScenarioDisk extends PascalDisk
SectorType experienceSector = new SectorType ("Experience", Color.darkGray);
SectorType treasureSector = new SectorType ("Treasure", Color.pink);
// ---------------------------------------------------------------------------------//
public WizardryScenarioDisk (Disk disk)
// ---------------------------------------------------------------------------------//
{
super (disk);
@ -116,8 +120,10 @@ public class WizardryScenarioDisk extends PascalDisk
}
}
// ---------------------------------------------------------------------------------//
private DefaultMutableTreeNode linkNode (String name, String text,
DefaultMutableTreeNode parent)
// ---------------------------------------------------------------------------------//
{
DefaultAppleFileSource afs = new DefaultAppleFileSource (name, text, this);
DefaultMutableTreeNode node = new DefaultMutableTreeNode (afs);
@ -125,7 +131,9 @@ public class WizardryScenarioDisk extends PascalDisk
return node;
}
// ---------------------------------------------------------------------------------//
public static boolean isWizardryFormat (Disk disk, boolean debug)
// ---------------------------------------------------------------------------------//
{
byte[] buffer = disk.readSector (2);
int totalFiles = HexFormatter.intValue (buffer[16], buffer[17]);
@ -142,31 +150,41 @@ public class WizardryScenarioDisk extends PascalDisk
return true;
}
// ---------------------------------------------------------------------------------//
@Override
public AppleFileSource getFile (String fileName)
// ---------------------------------------------------------------------------------//
{
// System.out.println ("Wizardry disk looking for : " + fileName);
return null;
}
// ---------------------------------------------------------------------------------//
public String getCatalogText ()
// ---------------------------------------------------------------------------------//
{
return null;
}
// ---------------------------------------------------------------------------------//
@Override
public List<DiskAddress> getFileSectors (int fileNo)
// ---------------------------------------------------------------------------------//
{
return null;
}
// ---------------------------------------------------------------------------------//
@Override
public DataSource getFile (int fileNo)
// ---------------------------------------------------------------------------------//
{
return null;
}
// ---------------------------------------------------------------------------------//
private void extractRewards (DefaultMutableTreeNode node, List<DiskAddress> sectors)
// ---------------------------------------------------------------------------------//
{
List<DiskAddress> nodeSectors = new ArrayList<> ();
ScenarioData sd = scenarioHeader.data.get (Header.TREASURE_TABLE_AREA);
@ -192,8 +210,10 @@ public class WizardryScenarioDisk extends PascalDisk
dds.text = text.toString ();
}
// ---------------------------------------------------------------------------------//
private int addReward (byte[] buffer, List<DiskAddress> blocks,
DefaultMutableTreeNode node, int seq)
// ---------------------------------------------------------------------------------//
{
int recLen = 168;
for (int ptr = 0; ptr < 1008; ptr += recLen)
@ -208,7 +228,9 @@ public class WizardryScenarioDisk extends PascalDisk
return seq;
}
// ---------------------------------------------------------------------------------//
private void extractCharacters (DefaultMutableTreeNode node, List<DiskAddress> sectors)
// ---------------------------------------------------------------------------------//
{
List<DiskAddress> nodeSectors = new ArrayList<> ();
ScenarioData sd = scenarioHeader.data.get (Header.CHARACTER_AREA);
@ -249,8 +271,10 @@ public class WizardryScenarioDisk extends PascalDisk
dds.text = text.toString ();
}
// ---------------------------------------------------------------------------------//
private void addCharacters (byte[] buffer, List<DiskAddress> blocks,
DefaultMutableTreeNode node)
// ---------------------------------------------------------------------------------//
{
int recLen = 208;
for (int ptr = 0; ptr < 832; ptr += recLen)
@ -269,7 +293,9 @@ public class WizardryScenarioDisk extends PascalDisk
}
}
// ---------------------------------------------------------------------------------//
private void extractMonsters (DefaultMutableTreeNode node, List<DiskAddress> sectors)
// ---------------------------------------------------------------------------------//
{
List<DiskAddress> nodeSectors = new ArrayList<> ();
ScenarioData sd = scenarioHeader.data.get (Header.MONSTER_AREA);
@ -302,8 +328,10 @@ public class WizardryScenarioDisk extends PascalDisk
dds.text = text.toString ();
}
// ---------------------------------------------------------------------------------//
private void addMonsters (byte[] buffer, List<DiskAddress> blocks,
DefaultMutableTreeNode node)
// ---------------------------------------------------------------------------------//
{
int recLen = 158;
for (int ptr = 0; ptr < 948; ptr += recLen)
@ -322,7 +350,9 @@ public class WizardryScenarioDisk extends PascalDisk
}
}
// ---------------------------------------------------------------------------------//
private void extractItems (DefaultMutableTreeNode node, List<DiskAddress> sectors)
// ---------------------------------------------------------------------------------//
{
List<DiskAddress> nodeSectors = new ArrayList<> ();
ScenarioData sd = scenarioHeader.data.get (Header.ITEM_AREA);
@ -355,8 +385,10 @@ public class WizardryScenarioDisk extends PascalDisk
dds.text = text.toString ();
}
// ---------------------------------------------------------------------------------//
private void addItems (byte[] buffer, List<DiskAddress> blocks,
DefaultMutableTreeNode node)
// ---------------------------------------------------------------------------------//
{
int recLen = 78;
for (int ptr = 0; ptr < 1014; ptr += recLen)
@ -374,7 +406,9 @@ public class WizardryScenarioDisk extends PascalDisk
}
}
// ---------------------------------------------------------------------------------//
private void extractSpells (DefaultMutableTreeNode node, List<DiskAddress> sectors)
// ---------------------------------------------------------------------------------//
{
spells = new ArrayList<> ();
List<DiskAddress> blocks = new ArrayList<> (2);
@ -410,7 +444,9 @@ public class WizardryScenarioDisk extends PascalDisk
}
}
// ---------------------------------------------------------------------------------//
private void extractMessages (DefaultMutableTreeNode node, List<DiskAddress> sectors)
// ---------------------------------------------------------------------------------//
{
Message.resetMessageId ();
messages = new ArrayList<> ();
@ -469,7 +505,9 @@ public class WizardryScenarioDisk extends PascalDisk
}
}
// ---------------------------------------------------------------------------------//
private void extractLevels (DefaultMutableTreeNode node, List<DiskAddress> sectors)
// ---------------------------------------------------------------------------------//
{
List<DiskAddress> nodeSectors = new ArrayList<> ();
ScenarioData sd = scenarioHeader.data.get (Header.MAZE_AREA);
@ -503,7 +541,9 @@ public class WizardryScenarioDisk extends PascalDisk
dds.text = text.toString ();
}
// ---------------------------------------------------------------------------------//
private void extractImages (DefaultMutableTreeNode node, List<DiskAddress> sectors)
// ---------------------------------------------------------------------------------//
{
List<DiskAddress> nodeSectors = new ArrayList<> ();
ScenarioData sd = scenarioHeader.data.get (Header.IMAGE_AREA);
@ -542,8 +582,10 @@ public class WizardryScenarioDisk extends PascalDisk
dds.text = text.toString ();
}
// ---------------------------------------------------------------------------------//
private void extractExperienceLevels (DefaultMutableTreeNode node,
List<DiskAddress> sectors)
// ---------------------------------------------------------------------------------//
{
List<DiskAddress> nodeSectors = new ArrayList<> ();
ScenarioData sd = scenarioHeader.data.get (Header.EXPERIENCE_AREA);
@ -573,16 +615,20 @@ public class WizardryScenarioDisk extends PascalDisk
afs.setSectors (nodeSectors);
}
// ---------------------------------------------------------------------------------//
private void addToNode (AbstractFile af, DefaultMutableTreeNode node, DiskAddress block,
SectorType type)
// ---------------------------------------------------------------------------------//
{
List<DiskAddress> blocks = new ArrayList<> (1);
blocks.add (block);
addToNode (af, node, blocks, type);
}
// ---------------------------------------------------------------------------------//
private void addToNode (AbstractFile af, DefaultMutableTreeNode node,
List<DiskAddress> blocks, SectorType type)
// ---------------------------------------------------------------------------------//
{
DefaultAppleFileSource dafs =
new DefaultAppleFileSource (af.getName (), af, this, blocks);
@ -591,8 +637,10 @@ public class WizardryScenarioDisk extends PascalDisk
childNode.setAllowsChildren (false);
}
// ---------------------------------------------------------------------------------//
private List<DiskAddress> getTwoBlocks (ScenarioData sd, int i,
List<DiskAddress> sectors)
// ---------------------------------------------------------------------------------//
{
List<DiskAddress> blocks = new ArrayList<> (2);
blocks.add (sectors.get (sd.dataOffset + i * 2));