mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2025-02-06 19:30:01 +00:00
found how to group characters
This commit is contained in:
parent
e408aa3d62
commit
ce52253f5d
@ -1,16 +0,0 @@
|
||||
package com.bytezone.diskbrowser.wizardry;
|
||||
|
||||
import com.bytezone.diskbrowser.applefile.AbstractFile;
|
||||
|
||||
// -----------------------------------------------------------------------------------//
|
||||
public class Character4 extends AbstractFile
|
||||
// -----------------------------------------------------------------------------------//
|
||||
{
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
Character4 (String name, byte[] buffer)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
super (name, buffer);
|
||||
}
|
||||
}
|
69
src/com/bytezone/diskbrowser/wizardry/CharacterV4.java
Normal file
69
src/com/bytezone/diskbrowser/wizardry/CharacterV4.java
Normal file
@ -0,0 +1,69 @@
|
||||
package com.bytezone.diskbrowser.wizardry;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.bytezone.diskbrowser.applefile.AbstractFile;
|
||||
import com.bytezone.diskbrowser.utilities.HexFormatter;
|
||||
import com.bytezone.diskbrowser.utilities.Utility;
|
||||
|
||||
// -----------------------------------------------------------------------------------//
|
||||
public class CharacterV4 extends AbstractFile
|
||||
// -----------------------------------------------------------------------------------//
|
||||
{
|
||||
int id;
|
||||
int nextCharacter;
|
||||
String slogan = "";
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
CharacterV4 (String name, byte[] buffer, int id)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
super (name, buffer);
|
||||
|
||||
this.id = id;
|
||||
nextCharacter = Utility.getShort (buffer, 0x7D);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
void link (List<CharacterV4> characters)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
String text = getPartialSlogan ();
|
||||
int nextCharacterId = this.nextCharacter;
|
||||
|
||||
while (nextCharacterId > 0 && nextCharacterId != id)
|
||||
{
|
||||
CharacterV4 next = characters.get (nextCharacterId);
|
||||
if (!next.slogan.isEmpty ())
|
||||
return;
|
||||
text += next.getPartialSlogan ();
|
||||
nextCharacterId = next.nextCharacter;
|
||||
}
|
||||
|
||||
slogan = text.replace ("\\", " - ");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
String getPartialSlogan ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
return buffer[17] == 0 ? "" : HexFormatter.getPascalString (buffer, 17);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@Override
|
||||
public String getText ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
StringBuilder text = new StringBuilder ();
|
||||
|
||||
text.append (String.format ("Id ............. %3d%n", id));
|
||||
text.append (String.format ("Name ........... %s%n", name));
|
||||
text.append (String.format ("Slogan ......... %s%n", slogan));
|
||||
text.append (String.format ("Next ........... %d%n%n", nextCharacter));
|
||||
|
||||
text.append (HexFormatter.format (buffer, 1, buffer[0] & 0xFF));
|
||||
|
||||
return text.toString ();
|
||||
}
|
||||
}
|
@ -1,16 +1,24 @@
|
||||
package com.bytezone.diskbrowser.wizardry;
|
||||
|
||||
import com.bytezone.diskbrowser.applefile.AbstractFile;
|
||||
import com.bytezone.diskbrowser.utilities.HexFormatter;
|
||||
|
||||
// -----------------------------------------------------------------------------------//
|
||||
public class ItemV4 extends AbstractFile
|
||||
// -----------------------------------------------------------------------------------//
|
||||
{
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
ItemV4 (String[] names, byte[] buffer, int id)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
super (names[1], buffer);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@Override
|
||||
public String getText ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
return HexFormatter.format (buffer, 1, buffer[0] & 0xFF);
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,24 @@
|
||||
package com.bytezone.diskbrowser.wizardry;
|
||||
|
||||
import com.bytezone.diskbrowser.applefile.AbstractFile;
|
||||
import com.bytezone.diskbrowser.utilities.HexFormatter;
|
||||
|
||||
// -----------------------------------------------------------------------------------//
|
||||
public class MonsterV4 extends AbstractFile
|
||||
// -----------------------------------------------------------------------------------//
|
||||
{
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
MonsterV4 (String[] names, byte[] buffer, int id)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
super (names[2], buffer);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@Override
|
||||
public String getText ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
return HexFormatter.format (buffer, 1, buffer[0] & 0xFF);
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,8 @@ public class Wizardry4BootDisk extends PascalDisk
|
||||
private Huffman huffman;
|
||||
private final int version;
|
||||
|
||||
private List<CharacterV4> characters = new ArrayList<> ();
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
public Wizardry4BootDisk (AppleDisk[] dataDisks)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@ -159,7 +161,9 @@ public class Wizardry4BootDisk extends PascalDisk
|
||||
|
||||
String name = HexFormatter.getPascalString (out, 1);
|
||||
|
||||
Character4 c = new Character4 (name, out);
|
||||
CharacterV4 c = new CharacterV4 (name, out, i);
|
||||
characters.add (c);
|
||||
|
||||
List<DiskAddress> characterBlocks = new ArrayList<> ();
|
||||
DiskAddress da = blocks.get (ptr / 512);
|
||||
characterBlocks.add (da);
|
||||
@ -173,6 +177,9 @@ public class Wizardry4BootDisk extends PascalDisk
|
||||
|
||||
DefaultAppleFileSource afs = (DefaultAppleFileSource) charactersNode.getUserObject ();
|
||||
afs.setSectors (allCharacterBlocks);
|
||||
|
||||
for (CharacterV4 character : characters)
|
||||
character.link (characters);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
|
Loading…
x
Reference in New Issue
Block a user