mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2024-11-25 16:34:00 +00:00
wiz 1-3 mazes
This commit is contained in:
parent
b5cf619733
commit
a2f2fb5d4e
@ -26,21 +26,21 @@ public class Utility
|
||||
.equals (AffineTransform.getScaleInstance (2.0, 2.0));
|
||||
}
|
||||
|
||||
public static void find (byte[] buffer, byte[] key)
|
||||
public static boolean find (byte[] buffer, byte[] key)
|
||||
{
|
||||
System.out.println ("*********** searching ************");
|
||||
// System.out.println (HexFormatter.format (buffer));
|
||||
for (int i = 0; i < buffer.length; i++)
|
||||
{
|
||||
// System.out.printf ("%02X %02X%n", buffer[i], key[0]);
|
||||
if (buffer[i] == key[0])
|
||||
{
|
||||
// System.out.println ("**** checking first ****");
|
||||
if (matches (buffer, i, key))
|
||||
{
|
||||
System.out.printf ("Matches at %04X%n", i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean matches (byte[] buffer, int offset, byte[] key)
|
||||
{
|
||||
|
@ -70,31 +70,74 @@ class MazeLevel extends AbstractFile
|
||||
"Elevator", "Rock/Water", "Fizzle", "Message/Item", "Monster" };
|
||||
|
||||
List<MazeAddress> messageList = new ArrayList<MazeAddress> ();
|
||||
text.append ("\n\nAddresses/Messages/Items\n\n");
|
||||
for (int i = 768, j = 0; i < 800; i += 2, j++)
|
||||
List<MazeAddress> monsterList = new ArrayList<MazeAddress> ();
|
||||
|
||||
text.append ("\n\nTable Index Contains \n");
|
||||
for (int j = 0; j < 16; j++)
|
||||
{
|
||||
String extraText = "";
|
||||
int val = buffer[760 + j / 2] & 0xFF;
|
||||
String extra = (j % 2) == 0 ? extras[val % 16] : extras[val / 16];
|
||||
MazeAddress address = getAddress (j);
|
||||
int k = (j % 2) == 0 ? val % 16 : val / 16;
|
||||
if (k == 11)
|
||||
messageList.add (address);
|
||||
text.append (String.format ("%04X-%04X-%04X: %04X %04X %04X : %X %X %s%n", i,
|
||||
i + 32, i + 64, address.level, address.row, address.column, j, k, extra));
|
||||
int cellFlag = (j % 2) == 0 ? val % 16 : val / 16;
|
||||
if (cellFlag == 11)
|
||||
{
|
||||
extraText = "Msg:" + String.format ("%04X ", address.row);
|
||||
messageList.add (address); // to print at the end
|
||||
|
||||
int messageType = address.column;
|
||||
if (messageType == 2)
|
||||
{
|
||||
extraText += "Obtained: ";
|
||||
if (items != null)
|
||||
extraText += items.get (address.level).getName ();
|
||||
}
|
||||
|
||||
if (messageType == 5)
|
||||
{
|
||||
extraText += "Requires: ";
|
||||
if (items != null)
|
||||
extraText += items.get (address.level).getName ();
|
||||
}
|
||||
|
||||
if (messageType == 4)
|
||||
{
|
||||
extraText += "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
if (cellFlag == 12)
|
||||
{
|
||||
monsterList.add (address);
|
||||
extraText = "Encounter: ";
|
||||
if (monsters != null)
|
||||
extraText += monsters.get (address.column).realName;
|
||||
}
|
||||
|
||||
text.append (String.format (" %X %X %-15s %04X %04X %04X %s%n", j,
|
||||
cellFlag, extra, address.level, address.row, address.column, extraText));
|
||||
}
|
||||
|
||||
text.append ("\nRest\n\n");
|
||||
text.append (HexFormatter.format (buffer, 864, buffer.length - 864));
|
||||
|
||||
text.append ("\n\n");
|
||||
text.append ("\n");
|
||||
for (MazeAddress address : messageList)
|
||||
{
|
||||
Message message = getMessage (address.row);
|
||||
text.append (address.row + "\n");
|
||||
text.append (String.format ("%nMessage: %04X%n", address.row));
|
||||
text.append (message.getText ());
|
||||
text.append ("\n");
|
||||
}
|
||||
|
||||
for (MazeAddress address : monsterList)
|
||||
{
|
||||
Monster monster = getMonster (address.column);
|
||||
text.append (String.format ("%nMonster: %04X%n", address.column));
|
||||
text.append (monster.getText ());
|
||||
text.append ("\n");
|
||||
}
|
||||
|
||||
return text.toString ();
|
||||
}
|
||||
|
||||
@ -116,7 +159,6 @@ class MazeLevel extends AbstractFile
|
||||
|
||||
private void addExtras (StringBuilder text, int ptr)
|
||||
{
|
||||
// StringBuilder text2 = new StringBuilder ();
|
||||
text.append ("\n\n");
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
@ -127,19 +169,9 @@ class MazeLevel extends AbstractFile
|
||||
int left = val / 16; // 0:F
|
||||
int right = val % 16; // 0:F
|
||||
text.append (String.format ("%X:%X ", right, left));
|
||||
|
||||
int c2 = buffer[760 + right / 2] & 0xFF; // 760 + 0:7
|
||||
int d2 = (right % 2 == 0) ? c2 % 16 : c2 / 16;
|
||||
// text2.append (String.format ("%02X %02X ", c2, d2));
|
||||
|
||||
int c1 = buffer[760 + left / 2] & 0xFF;
|
||||
int d1 = (left % 2 == 0) ? c1 % 16 : c1 / 16;
|
||||
// text2.append (String.format ("%02X %02X%n", c1, d1));
|
||||
}
|
||||
text.append ("\n");
|
||||
// text2.append ("\n");
|
||||
}
|
||||
// text.append (text2.toString ());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -231,9 +263,9 @@ class MazeLevel extends AbstractFile
|
||||
int b = (row % 2 == 0) ? value % 16 : value / 16; // 0:F
|
||||
|
||||
int c = buffer[760 + b / 2] & 0xFF; // 760:767
|
||||
int d = (b % 2 == 0) ? c % 16 : c / 16;
|
||||
int cellFlag = (b % 2 == 0) ? c % 16 : c / 16;
|
||||
|
||||
switch (d)
|
||||
switch (cellFlag)
|
||||
{
|
||||
case 0: // normal
|
||||
break;
|
||||
@ -266,7 +298,7 @@ class MazeLevel extends AbstractFile
|
||||
break;
|
||||
|
||||
case 7: // ouchy
|
||||
cell.unknown = d;
|
||||
cell.unknown = cellFlag;
|
||||
break;
|
||||
|
||||
case 8:
|
||||
@ -343,8 +375,8 @@ class MazeLevel extends AbstractFile
|
||||
break;
|
||||
|
||||
default:
|
||||
System.out.println ("Unknown extra: " + d);
|
||||
cell.unknown = d;
|
||||
System.out.println ("Unknown extra: " + cellFlag);
|
||||
cell.unknown = cellFlag;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -368,8 +400,18 @@ class MazeLevel extends AbstractFile
|
||||
if (m.match (messageNo))
|
||||
return m;
|
||||
|
||||
// if (cell.message == null)
|
||||
// System.out.println ("message not found : " + messageNum);
|
||||
return null;
|
||||
}
|
||||
|
||||
private Monster getMonster (int monsterNo)
|
||||
{
|
||||
if (monsters == null)
|
||||
return null;
|
||||
|
||||
for (Monster m : monsters)
|
||||
if (m.match (monsterNo))
|
||||
return m;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -42,8 +42,8 @@ class Monster extends AbstractFile implements Comparable<Monster>
|
||||
static int[] weight2 = { 0, 60, 120, 180, 300, 540, 1020, 0 };
|
||||
|
||||
public static String[] monsterClass =
|
||||
{ "Fighter", "Mage", "Priest", "Thief", "Midget", "Giant", "Mythical", "Dragon", "Animal",
|
||||
"Were", "Undead", "Demon", "Insect", "Enchanted" };
|
||||
{ "Fighter", "Mage", "Priest", "Thief", "Midget", "Giant", "Mythical", "Dragon",
|
||||
"Animal", "Were", "Undead", "Demon", "Insect", "Enchanted" };
|
||||
|
||||
private static int[] experience =
|
||||
{ 55, 235, 415, 230, 380, 620, 840, 520, 550, 350, // 00-09
|
||||
@ -58,7 +58,8 @@ class Monster extends AbstractFile implements Comparable<Monster>
|
||||
4155, 3000, 9200, 3160, 7460, 7320, 15880, 1600, 2200, 1000, 1900 // 90-100
|
||||
};
|
||||
|
||||
public Monster (String name, byte[] buffer, List<Reward> rewards, List<Monster> monsters)
|
||||
public Monster (String name, byte[] buffer, List<Reward> rewards,
|
||||
List<Monster> monsters)
|
||||
{
|
||||
super (name, buffer);
|
||||
|
||||
@ -104,7 +105,9 @@ class Monster extends AbstractFile implements Comparable<Monster>
|
||||
StringBuilder text = new StringBuilder ();
|
||||
|
||||
// these values definitely affect the damage a monster does (when breathing?)
|
||||
int exp2 = (HexFormatter.intValue (buffer[72]) * HexFormatter.intValue (buffer[74]) - 1) * 20;
|
||||
int exp2 =
|
||||
(HexFormatter.intValue (buffer[72]) * HexFormatter.intValue (buffer[74]) - 1)
|
||||
* 20;
|
||||
int exp3 = weight2[speed]; // 1-6
|
||||
int exp4 = (10 - armourClass) * 40;
|
||||
int exp5 = getBonus (35, mageSpellLevel);
|
||||
@ -169,8 +172,8 @@ class Monster extends AbstractFile implements Comparable<Monster>
|
||||
if (debug)
|
||||
text.append (" " + exp9);
|
||||
|
||||
text.append ("\n\nExperience ...... "
|
||||
+ (exp2 + exp3 + exp4 + exp5 + exp6 + exp7 + exp8 + exp9 + exp10 + exp11 + exp12));
|
||||
text.append ("\n\nExperience ...... " + (exp2 + exp3 + exp4 + exp5 + exp6 + exp7
|
||||
+ exp8 + exp9 + exp10 + exp11 + exp12));
|
||||
|
||||
text.append ("\n\n===== Gold reward ======");
|
||||
// text.append ("\nTable ........... " + rewardTable1);
|
||||
@ -188,7 +191,9 @@ class Monster extends AbstractFile implements Comparable<Monster>
|
||||
public int getExperience ()
|
||||
{
|
||||
// these values definitely affect the damage a monster does (when breathing?)
|
||||
int exp2 = (HexFormatter.intValue (buffer[72]) * HexFormatter.intValue (buffer[74]) - 1) * 20;
|
||||
int exp2 =
|
||||
(HexFormatter.intValue (buffer[72]) * HexFormatter.intValue (buffer[74]) - 1)
|
||||
* 20;
|
||||
int exp3 = weight2[speed];
|
||||
int exp4 = (10 - armourClass) * 40;
|
||||
int exp5 = getBonus (35, mageSpellLevel);
|
||||
@ -212,6 +217,7 @@ class Monster extends AbstractFile implements Comparable<Monster>
|
||||
this.image = image;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName ()
|
||||
{
|
||||
return realName;
|
||||
@ -234,7 +240,8 @@ class Monster extends AbstractFile implements Comparable<Monster>
|
||||
|
||||
public String getDump (int block)
|
||||
{
|
||||
StringBuilder line = new StringBuilder (String.format ("%3d %-16s", monsterID, realName));
|
||||
StringBuilder line =
|
||||
new StringBuilder (String.format ("%3d %-16s", monsterID, realName));
|
||||
int lo = block == 0 ? 64 : block == 1 ? 88 : block == 2 ? 112 : 136;
|
||||
int hi = lo + 24;
|
||||
if (hi > buffer.length)
|
||||
@ -251,6 +258,12 @@ 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)
|
||||
|
@ -53,6 +53,10 @@ public class Relocator extends AbstractFile
|
||||
public void createNewBuffer (Disk[] dataDisks)
|
||||
{
|
||||
AppleDisk master = (AppleDisk) dataDisks[0];
|
||||
// byte[] key1 = { 0x55, 0x55, 0x15, 0x55 };
|
||||
// byte[] key2 = { 0x00, 0x00, 0x01, 0x41 };
|
||||
// byte[] key3 = { 0x01, 0x00, 0x01, 0x41 };
|
||||
// byte[] key4 = { 0x00, 0x00, 0x15, 0x55 };
|
||||
|
||||
for (int logicalBlock = 0; logicalBlock < diskBlocks.length; logicalBlock++)
|
||||
{
|
||||
@ -63,6 +67,11 @@ public class Relocator extends AbstractFile
|
||||
byte[] temp = disk.readSector (diskOffsets[logicalBlock]);
|
||||
DiskAddress da = master.getDiskAddress (logicalBlock);
|
||||
master.writeSector (da, temp);
|
||||
// if (Utility.find (temp, key1))
|
||||
// if (Utility.find (temp, key2))
|
||||
// if (Utility.find (temp, key3))
|
||||
// if (Utility.find (temp, key4))
|
||||
// System.out.println (da);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user