Separated enemy encounter/death text

This commit is contained in:
jeffman 2015-08-13 15:57:49 -04:00
parent 5085647c62
commit 86e1803faf
12 changed files with 5791 additions and 5742 deletions

View File

@ -106,7 +106,7 @@ namespace ScriptTool
return refs.ToArray();
}
public static MainStringRef[] ReadEnemyTextRefs(byte[] rom)
public static MainStringRef[] ReadEnemyEncounters(byte[] rom)
{
var refs = new List<MainStringRef>();
int address = 0x159589;
@ -116,7 +116,18 @@ namespace ScriptTool
if (pointer != 0)
refs.Add(new MainStringRef { Index = i, PointerLocation = address + 0x2D, OldPointer = pointer });
pointer = rom.ReadSnesPointer(address + 0x31);
address += 94;
}
return refs.ToArray();
}
public static MainStringRef[] ReadEnemyDeaths(byte[] rom)
{
var refs = new List<MainStringRef>();
int address = 0x159589;
for (int i = 0; i < 231; i++)
{
int pointer = rom.ReadSnesPointer(address + 0x31);
if (pointer != 0)
refs.Add(new MainStringRef { Index = i, PointerLocation = address + 0x31, OldPointer = pointer });

View File

@ -234,7 +234,18 @@ namespace ScriptTool
if (pointer != 0)
refs.Add(new MainStringRef { Index = i, PointerLocation = address + 20, OldPointer = pointer });
pointer = rom.ReadGbaPointer(address + 24);
address += 64;
}
return refs.ToArray();
}
public static MainStringRef[] ReadEnemyDeaths(byte[] rom)
{
var refs = new List<MainStringRef>();
int address = 0x739D1C;
for (int i = 0; i < 231; i++)
{
int pointer = rom.ReadGbaPointer(address + 24);
if (pointer != 0)
refs.Add(new MainStringRef { Index = i, PointerLocation = address + 24, OldPointer = pointer });

View File

@ -172,7 +172,8 @@ namespace ScriptTool
allRefs.Add(Tuple.Create("eb-item-help", EbTextTables.ReadItemHelpRefs(ebRom)));
allRefs.Add(Tuple.Create("eb-psi-help", EbTextTables.ReadPsiHelpRefs(ebRom)));
allRefs.Add(Tuple.Create("eb-phone", EbTextTables.ReadPhoneRefs(ebRom)));
allRefs.Add(Tuple.Create("eb-enemy-encounters", EbTextTables.ReadEnemyTextRefs(ebRom)));
allRefs.Add(Tuple.Create("eb-enemy-encounters", EbTextTables.ReadEnemyEncounters(ebRom)));
allRefs.Add(Tuple.Create("eb-enemy-deaths", EbTextTables.ReadEnemyDeaths(ebRom)));
// Decompile
var allPointers = allRefs.SelectMany(rl => rl.Item2).Select(r => r.OldPointer);
@ -228,6 +229,7 @@ namespace ScriptTool
allRefs.Add(Tuple.Create("m12-phone-list", M12TextTables.ReadPhoneRefs(m12Rom)));
allRefs.Add(Tuple.Create("m12-unknown", M12TextTables.ReadUnknownRefs(m12Rom)));
allRefs.Add(Tuple.Create("m12-enemy-encounters", M12TextTables.ReadEnemyEncounters(m12Rom)));
allRefs.Add(Tuple.Create("m12-enemy-deaths", M12TextTables.ReadEnemyDeaths(m12Rom)));
allRefs.Add(Tuple.Create("m12-prayers", M12TextTables.ReadPrayerRefs(m12Rom)));
allRefs.Add(Tuple.Create("m12-asmrefs", M12TextTables.ReadAsmRefs(m12Rom)));
@ -357,6 +359,7 @@ namespace ScriptTool
"m12-unknown",
"m12-asmrefs",
"m12-enemy-encounters",
"m12-enemy-deaths",
"m12-prayers"
};

View File

@ -45,6 +45,8 @@ namespace ScriptToolGui
MatchedGroupCollection battleActionGroups = new MatchedGroupCollection("Battle actions", Game.Eb, Game.M12, Game.M12English);
MatchedGroupCollection itemHelpGroups = new MatchedGroupCollection("Item help", Game.Eb, Game.M12, Game.M12English);
MatchedGroupCollection psiHelpGroups = new MatchedGroupCollection("PSI help", Game.Eb, Game.M12, Game.M12English);
MatchedGroupCollection enemyEncounterGroups = new MatchedGroupCollection("Enemy encounters", Game.Eb, Game.M12, Game.M12English);
MatchedGroupCollection enemyDeathGroups = new MatchedGroupCollection("Enemy deaths", Game.Eb, Game.M12, Game.M12English);
MatchedGroupCollection rawM12Groups = new MatchedGroupCollection("Raw M12 strings", Game.M12, Game.M12English);
MatchedGroupCollection rawEbGroups = new MatchedGroupCollection("Raw EB strings", Game.Eb);
List<MatchedGroupCollection> matchedCollections = new List<MatchedGroupCollection>();
@ -182,11 +184,23 @@ namespace ScriptToolGui
var psiHelpMappingGroups = ebPsiHelpRefs.Select(e =>
new MatchedGroup(e,
m12PsiHelpRefs.First(m => m.Index == e.Index - 1)))
.ToArray();
.ToArray();
psiHelpGroups.Groups.AddRange(psiHelpMappingGroups);
psiHelpGroups.SortGroups();
// Enemy encounters
var m12EncounterRefs = ImportStringRefs("m12-enemy-encounters.json");
var ebEncounterRefs = ImportStringRefs("eb-enemy-encounters.json");
enemyEncounterGroups.Groups.AddRange(MatchRefs(ebEncounterRefs, m12EncounterRefs));
// Enemy deaths
var m12DeathRefs = ImportStringRefs("m12-enemy-deaths.json");
var ebDeathRefs = ImportStringRefs("eb-enemy-deaths.json");
enemyDeathGroups.Groups.AddRange(MatchRefs(ebDeathRefs, m12DeathRefs));
// Raw M12
var labels = Enumerable.Range(0, 5864);
foreach (int i in labels)
@ -205,6 +219,8 @@ namespace ScriptToolGui
matchedCollections.Add(battleActionGroups);
matchedCollections.Add(itemHelpGroups);
matchedCollections.Add(psiHelpGroups);
matchedCollections.Add(enemyEncounterGroups);
matchedCollections.Add(enemyDeathGroups);
matchedCollections.Add(rawM12Groups);
matchedCollections.Add(rawEbGroups);
}

1388
fresh/eb-enemy-deaths.json Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1388
fresh/m12-enemy-deaths.json Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1388
working/eb-enemy-deaths.json Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff