mirror of
https://github.com/AdAstra-LD/DS-Pokemon-Rom-Editor.git
synced 2026-05-18 02:21:06 -05:00
Progress on the advanced search feature
This commit is contained in:
parent
8306c82657
commit
bdfea335a2
127
DS_Map/Header.cs
127
DS_Map/Header.cs
|
|
@ -88,22 +88,23 @@ namespace DSPRE
|
|||
/*System*/
|
||||
public short ID { get; set; }
|
||||
public static readonly byte length = 24;
|
||||
public static readonly string nameSeparator = " - ";
|
||||
/**/
|
||||
|
||||
|
||||
#region Fields (10)
|
||||
public byte areaDataID { get; set; }
|
||||
public byte camera { get; set; }
|
||||
public ushort eventID { get; set; }
|
||||
public ushort levelScript { get; set; }
|
||||
public ushort matrix { get; set; }
|
||||
public ushort script { get; set; }
|
||||
public ushort musicDay { get; set; }
|
||||
public ushort musicNight { get; set; }
|
||||
public byte cameraAngleID { get; set; }
|
||||
public ushort eventFileID { get; set; }
|
||||
public ushort levelScriptID { get; set; }
|
||||
public ushort matrixID { get; set; }
|
||||
public ushort scriptFileID { get; set; }
|
||||
public ushort musicDayID { get; set; }
|
||||
public ushort musicNightID { get; set; }
|
||||
public byte showName { get; set; }
|
||||
public byte battleBackground { get; set; }
|
||||
public ushort text { get; set; }
|
||||
public byte weather { get; set; }
|
||||
public ushort textArchiveID { get; set; }
|
||||
public byte weatherID { get; set; }
|
||||
public byte flags { get; set; }
|
||||
public ushort wildPokémon { get; set; }
|
||||
#endregion Fields
|
||||
|
|
@ -152,17 +153,17 @@ namespace DSPRE
|
|||
using (BinaryReader reader = new BinaryReader(data)) {
|
||||
areaDataID = reader.ReadByte();
|
||||
unknown1 = reader.ReadByte();
|
||||
matrix = reader.ReadUInt16();
|
||||
script = reader.ReadUInt16();
|
||||
levelScript = reader.ReadUInt16();
|
||||
text = reader.ReadUInt16();
|
||||
musicDay = reader.ReadUInt16();
|
||||
musicNight = reader.ReadUInt16();
|
||||
matrixID = reader.ReadUInt16();
|
||||
scriptFileID = reader.ReadUInt16();
|
||||
levelScriptID = reader.ReadUInt16();
|
||||
textArchiveID = reader.ReadUInt16();
|
||||
musicDayID = reader.ReadUInt16();
|
||||
musicNightID = reader.ReadUInt16();
|
||||
wildPokémon = reader.ReadUInt16();
|
||||
eventID = reader.ReadUInt16();
|
||||
eventFileID = reader.ReadUInt16();
|
||||
locationName = reader.ReadUInt16();
|
||||
weather = StandardizeWeather(reader.ReadByte());
|
||||
camera = reader.ReadByte();
|
||||
weatherID = StandardizeWeather(reader.ReadByte());
|
||||
cameraAngleID = reader.ReadByte();
|
||||
showName = reader.ReadByte();
|
||||
|
||||
byte mapSettings = reader.ReadByte();
|
||||
|
|
@ -180,17 +181,17 @@ namespace DSPRE
|
|||
{
|
||||
writer.Write(areaDataID);
|
||||
writer.Write(unknown1);
|
||||
writer.Write(matrix);
|
||||
writer.Write(script);
|
||||
writer.Write(levelScript);
|
||||
writer.Write(text);
|
||||
writer.Write(musicDay);
|
||||
writer.Write(musicNight);
|
||||
writer.Write(matrixID);
|
||||
writer.Write(scriptFileID);
|
||||
writer.Write(levelScriptID);
|
||||
writer.Write(textArchiveID);
|
||||
writer.Write(musicDayID);
|
||||
writer.Write(musicNightID);
|
||||
writer.Write(wildPokémon);
|
||||
writer.Write(eventID);
|
||||
writer.Write(eventFileID);
|
||||
writer.Write(locationName);
|
||||
writer.Write(weather);
|
||||
writer.Write(camera);
|
||||
writer.Write(weatherID);
|
||||
writer.Write(cameraAngleID);
|
||||
writer.Write(showName);
|
||||
|
||||
byte mapSettings = (byte) ((battleBackground & 0b_1111) + ((flags & 0b_1111) << 4));
|
||||
|
|
@ -249,18 +250,18 @@ namespace DSPRE
|
|||
try {
|
||||
areaDataID = reader.ReadByte();
|
||||
unknown1 = reader.ReadByte();
|
||||
matrix = reader.ReadUInt16();
|
||||
script = reader.ReadUInt16();
|
||||
levelScript = reader.ReadUInt16();
|
||||
text = reader.ReadUInt16();
|
||||
musicDay = reader.ReadUInt16();
|
||||
musicNight = reader.ReadUInt16();
|
||||
matrixID = reader.ReadUInt16();
|
||||
scriptFileID = reader.ReadUInt16();
|
||||
levelScriptID = reader.ReadUInt16();
|
||||
textArchiveID = reader.ReadUInt16();
|
||||
musicDayID = reader.ReadUInt16();
|
||||
musicNightID = reader.ReadUInt16();
|
||||
wildPokémon = reader.ReadUInt16();
|
||||
eventID = reader.ReadUInt16();
|
||||
eventFileID = reader.ReadUInt16();
|
||||
locationName = reader.ReadByte();
|
||||
areaIcon = reader.ReadByte();
|
||||
weather = reader.ReadByte();
|
||||
camera = reader.ReadByte();
|
||||
weatherID = reader.ReadByte();
|
||||
cameraAngleID = reader.ReadByte();
|
||||
|
||||
ushort mapSettings = reader.ReadUInt16();
|
||||
showName = (byte)(mapSettings & 0b_1111_111);
|
||||
|
|
@ -282,18 +283,18 @@ namespace DSPRE
|
|||
{
|
||||
writer.Write(areaDataID);
|
||||
writer.Write(unknown1);
|
||||
writer.Write(matrix);
|
||||
writer.Write(script);
|
||||
writer.Write(levelScript);
|
||||
writer.Write(text);
|
||||
writer.Write(musicDay);
|
||||
writer.Write(musicNight);
|
||||
writer.Write(matrixID);
|
||||
writer.Write(scriptFileID);
|
||||
writer.Write(levelScriptID);
|
||||
writer.Write(textArchiveID);
|
||||
writer.Write(musicDayID);
|
||||
writer.Write(musicNightID);
|
||||
writer.Write(wildPokémon);
|
||||
writer.Write(eventID);
|
||||
writer.Write(eventFileID);
|
||||
writer.Write(locationName);
|
||||
writer.Write(areaIcon);
|
||||
writer.Write(weather);
|
||||
writer.Write(camera);
|
||||
writer.Write(weatherID);
|
||||
writer.Write(cameraAngleID);
|
||||
|
||||
ushort mapSettings = (ushort)((showName & 0b_1111_111) + ((battleBackground & 0b_1111_1) << 7) + ((flags & 0b_1111) << 12));
|
||||
writer.Write(mapSettings);
|
||||
|
|
@ -333,20 +334,20 @@ namespace DSPRE
|
|||
worldmapX = (byte)((coords >> 4) & 0b_1111_11); //get 6 bits after the first 4
|
||||
worldmapY = (byte)((coords >> 10) & 0b_1111_11); //get 6 bits after the first 10
|
||||
|
||||
matrix = reader.ReadUInt16();
|
||||
script = reader.ReadUInt16();
|
||||
levelScript = reader.ReadUInt16();
|
||||
text = reader.ReadUInt16();
|
||||
musicDay = reader.ReadUInt16();
|
||||
musicNight = reader.ReadUInt16();
|
||||
eventID = reader.ReadUInt16();
|
||||
matrixID = reader.ReadUInt16();
|
||||
scriptFileID = reader.ReadUInt16();
|
||||
levelScriptID = reader.ReadUInt16();
|
||||
textArchiveID = reader.ReadUInt16();
|
||||
musicDayID = reader.ReadUInt16();
|
||||
musicNightID = reader.ReadUInt16();
|
||||
eventFileID = reader.ReadUInt16();
|
||||
locationName = reader.ReadByte();
|
||||
areaIcon = StandardizeAreaIcon(reader.ReadByte());
|
||||
weather = reader.ReadByte();
|
||||
weatherID = reader.ReadByte();
|
||||
|
||||
byte cameraAndArea = reader.ReadByte();
|
||||
areaSettings = (byte)(cameraAndArea & 0b_1111); //get 4 bits
|
||||
camera = (byte)(cameraAndArea >> 4 & 0b_1111); //get 4 bits after the first 4
|
||||
cameraAngleID = (byte)(cameraAndArea >> 4 & 0b_1111); //get 4 bits after the first 4
|
||||
|
||||
|
||||
followMode = reader.ReadByte();
|
||||
|
|
@ -371,18 +372,18 @@ namespace DSPRE
|
|||
ushort worldMapCoordinates = (ushort) ( (unknown0 & 0b_1111) + ((worldmapX & 0b_1111_1111) << 4) + ((worldmapY & 0b_1111_1111) << 10) );
|
||||
writer.Write(worldMapCoordinates);
|
||||
|
||||
writer.Write(matrix);
|
||||
writer.Write(script);
|
||||
writer.Write(levelScript);
|
||||
writer.Write(text);
|
||||
writer.Write(musicDay);
|
||||
writer.Write(musicNight);
|
||||
writer.Write(eventID);
|
||||
writer.Write(matrixID);
|
||||
writer.Write(scriptFileID);
|
||||
writer.Write(levelScriptID);
|
||||
writer.Write(textArchiveID);
|
||||
writer.Write(musicDayID);
|
||||
writer.Write(musicNightID);
|
||||
writer.Write(eventFileID);
|
||||
writer.Write(locationName);
|
||||
writer.Write(areaIcon);
|
||||
writer.Write(weather);
|
||||
writer.Write(weatherID);
|
||||
|
||||
byte cameraAndArea = (byte) ((areaSettings & 0b_1111) + ((camera & 0b_1111) << 4));
|
||||
byte cameraAndArea = (byte) ((areaSettings & 0b_1111) + ((cameraAngleID & 0b_1111) << 4));
|
||||
writer.Write(cameraAndArea);
|
||||
|
||||
writer.Write(followMode);
|
||||
|
|
|
|||
|
|
@ -3,15 +3,13 @@ using System.Collections.Generic;
|
|||
using System.Windows.Forms;
|
||||
|
||||
namespace DSPRE {
|
||||
public partial class HeaderSearch : Form
|
||||
{
|
||||
public partial class HeaderSearch : Form {
|
||||
private List<string> searchableHeaderFieldsList = new List<string>() {
|
||||
"AreaData ID",
|
||||
"Area Data ID",
|
||||
"Camera Angle ID",
|
||||
"Event File ID",
|
||||
"Internal Name",
|
||||
"Level Script File ID",
|
||||
"Location Name",
|
||||
"Level Script ID",
|
||||
"Matrix ID",
|
||||
"Music Day ID",
|
||||
"Music Night ID",
|
||||
|
|
@ -19,6 +17,8 @@ namespace DSPRE {
|
|||
"Text Archive ID",
|
||||
"Weather ID",
|
||||
};
|
||||
private bool propertyIsNumeric = false;
|
||||
|
||||
private List<string> headerSearchNumericOperatorsList = new List<string>() {
|
||||
"Is Less than",
|
||||
"Equals",
|
||||
|
|
@ -29,6 +29,7 @@ namespace DSPRE {
|
|||
};
|
||||
private List<string> headerSearchTextOperatorsList = new List<string>() {
|
||||
"Is Exactly",
|
||||
"Is Not",
|
||||
"Contains",
|
||||
"Does not contain"
|
||||
};
|
||||
|
|
@ -38,14 +39,16 @@ namespace DSPRE {
|
|||
private string[] headerSearchTextOperators;
|
||||
|
||||
private List<string> intNames;
|
||||
private ListBox headerListBox;
|
||||
|
||||
public HeaderSearch(ref List<string> internalNames) {
|
||||
public HeaderSearch(ref List<string> internalNames, ListBox headerListBox) {
|
||||
InitializeComponent();
|
||||
searchableHeaderFields = searchableHeaderFieldsList.ToArray();
|
||||
headerSearchNumericOperators = headerSearchNumericOperatorsList.ToArray();
|
||||
headerSearchTextOperators = headerSearchTextOperatorsList.ToArray();
|
||||
|
||||
intNames = internalNames;
|
||||
this.headerListBox = headerListBox;
|
||||
|
||||
fieldToSearch1ComboBox.Items.AddRange(searchableHeaderFields);
|
||||
fieldToSearch2ComboBox.Items.AddRange(searchableHeaderFields);
|
||||
|
|
@ -76,20 +79,59 @@ namespace DSPRE {
|
|||
|
||||
if (fieldToSearchComboBox.SelectedItem.ToString().Contains("ID")) {
|
||||
operatorComboBox.Items.AddRange(headerSearchNumericOperators);
|
||||
propertyIsNumeric = true;
|
||||
} else {
|
||||
operatorComboBox.Items.AddRange(headerSearchTextOperators);
|
||||
propertyIsNumeric = false;
|
||||
}
|
||||
|
||||
fieldToSearchComboBox.SelectedIndex = 0;
|
||||
operatorComboBox.SelectedIndex = 0;
|
||||
}
|
||||
#endregion
|
||||
public static List<string> advancedSearch(short startID, short finalID, List<string> intNames, string fieldToSearch, string oper, string valToSearch) {
|
||||
if (fieldToSearch == "" || oper == "" || valToSearch == "")
|
||||
return null;
|
||||
|
||||
List<string> result = new List<string>();
|
||||
|
||||
for (short i = startID; i < finalID; i++) {
|
||||
if (fieldToSearch.Equals("Internal Name")) {
|
||||
if (oper.Equals("Is Exactly"))
|
||||
if (intNames[i].Equals(valToSearch)) {
|
||||
result.Add(i.ToString("D3") + Header.nameSeparator + intNames[i]);
|
||||
}
|
||||
if (oper.Equals("Is Not"))
|
||||
if (!intNames[i].Equals(valToSearch)) {
|
||||
result.Add(i.ToString("D3") + Header.nameSeparator + intNames[i]);
|
||||
}
|
||||
if (oper.Equals("Contains"))
|
||||
if (intNames[i].Contains(valToSearch)) {
|
||||
result.Add(i.ToString("D3") + Header.nameSeparator + intNames[i]);
|
||||
}
|
||||
if (oper.Equals("Does not contain"))
|
||||
if (!intNames[i].Contains(valToSearch)) {
|
||||
result.Add(i.ToString("D3") + Header.nameSeparator + intNames[i]);
|
||||
}
|
||||
} else {
|
||||
string[] fieldSplit = fieldToSearch.Split();
|
||||
fieldSplit[0] = fieldSplit[0].ToLower();
|
||||
string property = String.Join("", fieldSplit);
|
||||
|
||||
var headerField = typeof(Header).GetProperty(property).GetValue(Header.LoadFromARM9(i), null);
|
||||
|
||||
if (headerField.ToString().Equals(valToSearch))
|
||||
result.Add(i.ToString("D3") + Header.nameSeparator + intNames[i]);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
private void startSearchButton_Click(object sender, EventArgs e) {
|
||||
for (short i = 0; i < intNames.Count; i++) {
|
||||
Header h = Header.LoadFromARM9(i);
|
||||
headerListBox.Items.Clear();
|
||||
List<string> result = advancedSearch(0, (short)intNames.Count, intNames, fieldToSearch1ComboBox.Text, operator1ComboBox.SelectedItem.ToString(), value1TextBox.Text);
|
||||
|
||||
}
|
||||
if (result != null) {
|
||||
headerListBox.Items.AddRange(result.ToArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,9 +30,6 @@ namespace DSPRE {
|
|||
#region Variables
|
||||
public bool disableHandlers = false;
|
||||
public bool iconON = false;
|
||||
public bool expandedARM9;
|
||||
|
||||
private const string nameSeparator = " - ";
|
||||
|
||||
/* Editors Setup */
|
||||
public bool matrixEditorIsReady { get; private set; } = false;
|
||||
|
|
@ -399,7 +396,7 @@ namespace DSPRE {
|
|||
byte[] row = reader.ReadBytes(RomInfo.internalNameLength);
|
||||
|
||||
string internalName = Encoding.ASCII.GetString(row);//.TrimEnd();
|
||||
headerListBox.Items.Add(i.ToString("D3") + nameSeparator + internalName);
|
||||
headerListBox.Items.Add(i.ToString("D3") + Header.nameSeparator + internalName);
|
||||
internalNames.Add(internalName.TrimEnd('\0'));
|
||||
}
|
||||
}
|
||||
|
|
@ -516,7 +513,7 @@ namespace DSPRE {
|
|||
break;
|
||||
};
|
||||
string nsbmdName = Encoding.UTF8.GetString(reader.ReadBytes(16));
|
||||
selectMapComboBox.Items.Add(i.ToString("D3") + nameSeparator + nsbmdName);
|
||||
selectMapComboBox.Items.Add(i.ToString("D3") + Header.nameSeparator + nsbmdName);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1105,16 +1102,16 @@ namespace DSPRE {
|
|||
switch (RomInfo.gameVersion) {
|
||||
case "D":
|
||||
case "P":
|
||||
currentHeader.camera = (byte)cameraComboBox.SelectedIndex;
|
||||
currentHeader.cameraAngleID = (byte)cameraComboBox.SelectedIndex;
|
||||
imageName = "dpcamera" + cameraComboBox.SelectedIndex.ToString();
|
||||
break;
|
||||
case "Plat":
|
||||
currentHeader.camera = (byte)cameraComboBox.SelectedIndex;
|
||||
currentHeader.cameraAngleID = (byte)cameraComboBox.SelectedIndex;
|
||||
imageName = "ptcamera" + cameraComboBox.SelectedIndex.ToString();
|
||||
break;
|
||||
default:
|
||||
currentHeader.camera = Byte.Parse(cameraComboBox.SelectedItem.ToString().Substring(1, 2));
|
||||
imageName = "hgsscamera" + currentHeader.camera.ToString("D2");
|
||||
currentHeader.cameraAngleID = Byte.Parse(cameraComboBox.SelectedItem.ToString().Substring(1, 2));
|
||||
imageName = "hgsscamera" + currentHeader.cameraAngleID.ToString("D2");
|
||||
break;
|
||||
}
|
||||
cameraPictureBox.Image = (Image)Properties.Resources.ResourceManager.GetObject(imageName);
|
||||
|
|
@ -1125,7 +1122,7 @@ namespace DSPRE {
|
|||
private void eventFileUpDown_ValueChanged(object sender, EventArgs e) {
|
||||
if (disableHandlers)
|
||||
return;
|
||||
currentHeader.eventID = (ushort)eventFileUpDown.Value;
|
||||
currentHeader.eventFileID = (ushort)eventFileUpDown.Value;
|
||||
}
|
||||
private void headerFlagsCheckBoxes_CheckedChanged(object sender, EventArgs e) {
|
||||
if (disableHandlers)
|
||||
|
|
@ -1172,16 +1169,16 @@ namespace DSPRE {
|
|||
private void refreshHeaderEditorFields() {
|
||||
/* Setup controls for common fields across headers */
|
||||
internalNameBox.Text = internalNames[currentHeader.ID];
|
||||
matrixUpDown.Value = currentHeader.matrix;
|
||||
matrixUpDown.Value = currentHeader.matrixID;
|
||||
areaDataUpDown.Value = currentHeader.areaDataID;
|
||||
scriptFileUpDown.Value = currentHeader.script;
|
||||
levelScriptUpDown.Value = currentHeader.levelScript;
|
||||
eventFileUpDown.Value = currentHeader.eventID;
|
||||
textFileUpDown.Value = currentHeader.text;
|
||||
scriptFileUpDown.Value = currentHeader.scriptFileID;
|
||||
levelScriptUpDown.Value = currentHeader.levelScriptID;
|
||||
eventFileUpDown.Value = currentHeader.eventFileID;
|
||||
textFileUpDown.Value = currentHeader.textArchiveID;
|
||||
wildPokeUpDown.Value = currentHeader.wildPokémon;
|
||||
weatherUpDown.Value = currentHeader.weather;
|
||||
weatherUpDown.Value = currentHeader.weatherID;
|
||||
|
||||
cameraComboBox.SelectedIndex = cameraComboBox.FindString("[" + currentHeader.camera.ToString("D2"));
|
||||
cameraComboBox.SelectedIndex = cameraComboBox.FindString("[" + currentHeader.cameraAngleID.ToString("D2"));
|
||||
|
||||
if (RomInfo.gameVersion == "HG" || RomInfo.gameVersion == "SS")
|
||||
areaSettingsComboBox.SelectedIndex = cameraComboBox.FindString("[" + ((HeaderHGSS)currentHeader).areaSettings.ToString("D2"));
|
||||
|
|
@ -1196,24 +1193,24 @@ namespace DSPRE {
|
|||
case "D":
|
||||
case "P":
|
||||
locationNameComboBox.SelectedIndex = ((HeaderDP)currentHeader).locationName;
|
||||
musicDayUpDown.Value = ((HeaderDP)currentHeader).musicDay;
|
||||
musicNightUpDown.Value = ((HeaderDP)currentHeader).musicNight;
|
||||
musicDayUpDown.Value = ((HeaderDP)currentHeader).musicDayID;
|
||||
musicNightUpDown.Value = ((HeaderDP)currentHeader).musicNightID;
|
||||
areaSettingsComboBox.SelectedIndex = areaSettingsComboBox.FindString("[" + $"{currentHeader.showName:D3}");
|
||||
battleBackgroundUpDown.Value = currentHeader.battleBackground;
|
||||
break;
|
||||
case "Plat":
|
||||
areaIconComboBox.SelectedIndex = ((HeaderPt)currentHeader).areaIcon;
|
||||
locationNameComboBox.SelectedIndex = ((HeaderPt)currentHeader).locationName;
|
||||
musicDayUpDown.Value = ((HeaderPt)currentHeader).musicDay;
|
||||
musicNightUpDown.Value = ((HeaderPt)currentHeader).musicNight;
|
||||
musicDayUpDown.Value = ((HeaderPt)currentHeader).musicDayID;
|
||||
musicNightUpDown.Value = ((HeaderPt)currentHeader).musicNightID;
|
||||
areaSettingsComboBox.SelectedIndex = areaSettingsComboBox.FindString("[" + $"{currentHeader.showName:D3}");
|
||||
battleBackgroundUpDown.Value = currentHeader.battleBackground;
|
||||
break;
|
||||
default:
|
||||
areaIconComboBox.SelectedIndex = areaIconComboBox.FindString("[" + $"{((HeaderHGSS)currentHeader).areaIcon:D3}");
|
||||
locationNameComboBox.SelectedIndex = ((HeaderHGSS)currentHeader).locationName;
|
||||
musicDayUpDown.Value = ((HeaderHGSS)currentHeader).musicDay;
|
||||
musicNightUpDown.Value = ((HeaderHGSS)currentHeader).musicNight;
|
||||
musicDayUpDown.Value = ((HeaderHGSS)currentHeader).musicDayID;
|
||||
musicNightUpDown.Value = ((HeaderHGSS)currentHeader).musicNightID;
|
||||
worldmapXCoordUpDown.Value = ((HeaderHGSS)currentHeader).worldmapX;
|
||||
worldmapYCoordUpDown.Value = ((HeaderHGSS)currentHeader).worldmapY;
|
||||
break;
|
||||
|
|
@ -1260,7 +1257,7 @@ namespace DSPRE {
|
|||
private void levelScriptUpDown_ValueChanged(object sender, EventArgs e) {
|
||||
if (disableHandlers)
|
||||
return;
|
||||
currentHeader.levelScript = (ushort)levelScriptUpDown.Value;
|
||||
currentHeader.levelScriptID = (ushort)levelScriptUpDown.Value;
|
||||
}
|
||||
private void mapNameComboBox_SelectedIndexChanged(object sender, EventArgs e) {
|
||||
if (disableHandlers)
|
||||
|
|
@ -1282,7 +1279,7 @@ namespace DSPRE {
|
|||
private void matrixUpDown_ValueChanged(object sender, EventArgs e) {
|
||||
if (disableHandlers)
|
||||
return;
|
||||
currentHeader.matrix = (ushort)matrixUpDown.Value;
|
||||
currentHeader.matrixID = (ushort)matrixUpDown.Value;
|
||||
}
|
||||
private void musicDayComboBox_SelectedIndexChanged(object sender, EventArgs e) {
|
||||
if (disableHandlers)
|
||||
|
|
@ -1290,13 +1287,13 @@ namespace DSPRE {
|
|||
switch (RomInfo.gameVersion) {
|
||||
case "D":
|
||||
case "P":
|
||||
currentHeader.musicDay = (ushort)(musicDayUpDown.Value = PokeDatabase.MusicDB.DPMusicDict.Keys.ElementAt(musicDayComboBox.SelectedIndex));
|
||||
currentHeader.musicDayID = (ushort)(musicDayUpDown.Value = PokeDatabase.MusicDB.DPMusicDict.Keys.ElementAt(musicDayComboBox.SelectedIndex));
|
||||
break;
|
||||
case "Plat":
|
||||
currentHeader.musicDay = (ushort)(musicDayUpDown.Value = PokeDatabase.MusicDB.PtMusicDict.Keys.ElementAt(musicDayComboBox.SelectedIndex));
|
||||
currentHeader.musicDayID = (ushort)(musicDayUpDown.Value = PokeDatabase.MusicDB.PtMusicDict.Keys.ElementAt(musicDayComboBox.SelectedIndex));
|
||||
break;
|
||||
default:
|
||||
currentHeader.musicDay = (ushort)(musicDayUpDown.Value = PokeDatabase.MusicDB.HGSSMusicDict.Keys.ElementAt(musicDayComboBox.SelectedIndex));
|
||||
currentHeader.musicDayID = (ushort)(musicDayUpDown.Value = PokeDatabase.MusicDB.HGSSMusicDict.Keys.ElementAt(musicDayComboBox.SelectedIndex));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -1307,13 +1304,13 @@ namespace DSPRE {
|
|||
switch (RomInfo.gameVersion) {
|
||||
case "D":
|
||||
case "P":
|
||||
currentHeader.musicNight= (ushort)(musicNightUpDown.Value = PokeDatabase.MusicDB.DPMusicDict.Keys.ElementAt(musicNightComboBox.SelectedIndex));
|
||||
currentHeader.musicNightID= (ushort)(musicNightUpDown.Value = PokeDatabase.MusicDB.DPMusicDict.Keys.ElementAt(musicNightComboBox.SelectedIndex));
|
||||
break;
|
||||
case "Plat":
|
||||
currentHeader.musicNight = (ushort)(musicNightUpDown.Value = PokeDatabase.MusicDB.PtMusicDict.Keys.ElementAt(musicNightComboBox.SelectedIndex));
|
||||
currentHeader.musicNightID = (ushort)(musicNightUpDown.Value = PokeDatabase.MusicDB.PtMusicDict.Keys.ElementAt(musicNightComboBox.SelectedIndex));
|
||||
break;
|
||||
default:
|
||||
currentHeader.musicNight = (ushort)(musicNightUpDown.Value = PokeDatabase.MusicDB.HGSSMusicDict.Keys.ElementAt(musicNightComboBox.SelectedIndex));
|
||||
currentHeader.musicNightID = (ushort)(musicNightUpDown.Value = PokeDatabase.MusicDB.HGSSMusicDict.Keys.ElementAt(musicNightComboBox.SelectedIndex));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -1324,7 +1321,7 @@ namespace DSPRE {
|
|||
disableHandlers = true;
|
||||
try {
|
||||
ushort updValue = (ushort)((NumericUpDown)sender).Value;
|
||||
currentHeader.musicDay = updValue;
|
||||
currentHeader.musicDayID = updValue;
|
||||
switch (RomInfo.gameVersion) {
|
||||
case "D":
|
||||
case "P":
|
||||
|
|
@ -1349,7 +1346,7 @@ namespace DSPRE {
|
|||
disableHandlers = true;
|
||||
try {
|
||||
ushort updValue = (ushort)((NumericUpDown)sender).Value;
|
||||
currentHeader.musicNight = updValue;
|
||||
currentHeader.musicNightID = updValue;
|
||||
switch (RomInfo.gameVersion) {
|
||||
case "D":
|
||||
case "P":
|
||||
|
|
@ -1369,7 +1366,7 @@ namespace DSPRE {
|
|||
}
|
||||
|
||||
private void weatherUpDown_ValueChanged(object sender, EventArgs e) {
|
||||
currentHeader.weather = (byte)weatherUpDown.Value;
|
||||
currentHeader.weatherID = (byte)weatherUpDown.Value;
|
||||
updateWeatherPicAndComboBox();
|
||||
}
|
||||
private void worldmapXCoordUpDown_ValueChanged(object sender, EventArgs e) {
|
||||
|
|
@ -1388,13 +1385,13 @@ namespace DSPRE {
|
|||
switch (RomInfo.gameVersion) {
|
||||
case "D":
|
||||
case "P":
|
||||
weatherComboBox.SelectedItem = PokeDatabase.Weather.DPWeatherDict[currentHeader.weather];
|
||||
weatherComboBox.SelectedItem = PokeDatabase.Weather.DPWeatherDict[currentHeader.weatherID];
|
||||
break;
|
||||
case "Plat":
|
||||
weatherComboBox.SelectedItem = PokeDatabase.Weather.PtWeatherDict[currentHeader.weather];
|
||||
weatherComboBox.SelectedItem = PokeDatabase.Weather.PtWeatherDict[currentHeader.weatherID];
|
||||
break;
|
||||
default:
|
||||
weatherComboBox.SelectedItem = PokeDatabase.Weather.HGSSWeatherDict[currentHeader.weather];
|
||||
weatherComboBox.SelectedItem = PokeDatabase.Weather.HGSSWeatherDict[currentHeader.weatherID];
|
||||
break;
|
||||
}
|
||||
} catch (KeyNotFoundException) {
|
||||
|
|
@ -1447,7 +1444,7 @@ namespace DSPRE {
|
|||
weatherUpDown.Value = PokeDatabase.Weather.HGSSWeatherDict.Keys.ElementAt(weatherComboBox.SelectedIndex);
|
||||
break;
|
||||
}
|
||||
currentHeader.weather = (byte)weatherUpDown.Value;
|
||||
currentHeader.weatherID = (byte)weatherUpDown.Value;
|
||||
|
||||
}
|
||||
private void openAreaDataButton_Click(object sender, EventArgs e) {
|
||||
|
|
@ -1524,7 +1521,7 @@ namespace DSPRE {
|
|||
private void updateHeaderNameShown(int thisIndex, int headerNumber, string text) {
|
||||
disableHandlers = true;
|
||||
|
||||
headerListBox.Items[thisIndex] = headerNumber.ToString("D3") + nameSeparator + text;
|
||||
headerListBox.Items[thisIndex] = headerNumber.ToString("D3") + Header.nameSeparator + text;
|
||||
|
||||
disableHandlers = false;
|
||||
}
|
||||
|
|
@ -1541,7 +1538,7 @@ namespace DSPRE {
|
|||
|
||||
for (int i = 0; i < internalNames.Count; i++) {
|
||||
String name = internalNames[i];
|
||||
headerListBox.Items.Add(i.ToString("D3") + nameSeparator + name);
|
||||
headerListBox.Items.Add(i.ToString("D3") + Header.nameSeparator + name);
|
||||
}
|
||||
}
|
||||
private void searchHeaderTextBox_KeyPress(object sender, KeyEventArgs e) {
|
||||
|
|
@ -1557,14 +1554,13 @@ namespace DSPRE {
|
|||
headerListBox.Items.Clear();
|
||||
bool noResult = true;
|
||||
|
||||
|
||||
switch (RomInfo.gameVersion) {
|
||||
case "D":
|
||||
case "P":
|
||||
for (short i = 0; i < internalNames.Count; i++) {
|
||||
String locationName = locationNameComboBox.Items[((HeaderDP)Header.LoadFromARM9(i)).locationName].ToString();
|
||||
if (locationName.IndexOf(searchLocationTextBox.Text, StringComparison.InvariantCultureIgnoreCase) >= 0) {
|
||||
headerListBox.Items.Add(i.ToString("D3") + nameSeparator + internalNames[i]);
|
||||
headerListBox.Items.Add(i.ToString("D3") + Header.nameSeparator + internalNames[i]);
|
||||
noResult = false;
|
||||
}
|
||||
}
|
||||
|
|
@ -1573,7 +1569,7 @@ namespace DSPRE {
|
|||
for (short i = 0; i < internalNames.Count; i++) {
|
||||
String locationName = locationNameComboBox.Items[((HeaderPt)Header.LoadFromARM9(i)).locationName].ToString();
|
||||
if (locationName.IndexOf(searchLocationTextBox.Text, StringComparison.InvariantCultureIgnoreCase) >= 0) {
|
||||
headerListBox.Items.Add(i.ToString("D3") + nameSeparator + internalNames[i]);
|
||||
headerListBox.Items.Add(i.ToString("D3") + Header.nameSeparator + internalNames[i]);
|
||||
noResult = false;
|
||||
}
|
||||
}
|
||||
|
|
@ -1583,7 +1579,7 @@ namespace DSPRE {
|
|||
for (short i = 0; i < internalNames.Count; i++) {
|
||||
String locationName = locationNameComboBox.Items[((HeaderHGSS)Header.LoadFromARM9(i)).locationName].ToString();
|
||||
if (locationName.IndexOf(searchLocationTextBox.Text, StringComparison.InvariantCultureIgnoreCase) >= 0) {
|
||||
headerListBox.Items.Add(i.ToString("D3") + nameSeparator + internalNames[i]);
|
||||
headerListBox.Items.Add(i.ToString("D3") + Header.nameSeparator + internalNames[i]);
|
||||
noResult = false;
|
||||
}
|
||||
}
|
||||
|
|
@ -1603,7 +1599,7 @@ namespace DSPRE {
|
|||
private void scriptFileUpDown_ValueChanged(object sender, EventArgs e) {
|
||||
if (disableHandlers)
|
||||
return;
|
||||
currentHeader.script = (ushort)scriptFileUpDown.Value;
|
||||
currentHeader.scriptFileID = (ushort)scriptFileUpDown.Value;
|
||||
}
|
||||
private void areaSettingsComboBox_SelectedIndexChanged(object sender, EventArgs e) {
|
||||
if (disableHandlers || areaSettingsComboBox.SelectedItem == null)
|
||||
|
|
@ -1635,7 +1631,7 @@ namespace DSPRE {
|
|||
private void textFileUpDown_ValueChanged(object sender, EventArgs e) {
|
||||
if (disableHandlers)
|
||||
return;
|
||||
currentHeader.text = (ushort)textFileUpDown.Value;
|
||||
currentHeader.textArchiveID = (ushort)textFileUpDown.Value;
|
||||
}
|
||||
|
||||
private void wildPokeUpDown_ValueChanged(object sender, EventArgs e) {
|
||||
|
|
@ -2525,7 +2521,7 @@ namespace DSPRE {
|
|||
string[] bldList = GetBuildingsList(interiorbldRadioButton.Checked);
|
||||
for (int i = 0; i < currentMapFile.buildings.Count; i++)
|
||||
// Add entry into buildings ListBox
|
||||
buildingsListBox.Items.Add((i+1).ToString("D2") + nameSeparator + buildIndexComboBox.Items[(int)currentMapFile.buildings[i].modelID]);
|
||||
buildingsListBox.Items.Add((i+1).ToString("D2") + Header.nameSeparator + buildIndexComboBox.Items[(int)currentMapFile.buildings[i].modelID]);
|
||||
}
|
||||
private Building LoadBuildingModel(Building building, bool interior) {
|
||||
string modelPath = romInfo.GetBuildingModelsDirPath(interior) + "\\" + building.modelID.ToString("D4");
|
||||
|
|
@ -2637,7 +2633,7 @@ namespace DSPRE {
|
|||
using (BinaryWriter writer = new BinaryWriter(new FileStream(mapFilePath, FileMode.Create))) writer.Write(LoadMapFile(0).Save());
|
||||
|
||||
/* Update ComboBox and select new file */
|
||||
selectMapComboBox.Items.Add(selectMapComboBox.Items.Count.ToString("D3") + nameSeparator + "newmap");
|
||||
selectMapComboBox.Items.Add(selectMapComboBox.Items.Count.ToString("D3") + Header.nameSeparator + "newmap");
|
||||
selectMapComboBox.SelectedIndex = selectMapComboBox.Items.Count - 1;
|
||||
}
|
||||
private void replaceMapBinButton_Click(object sender, EventArgs e) {
|
||||
|
|
@ -2911,7 +2907,7 @@ namespace DSPRE {
|
|||
currentMapFile.buildings[currentMapFile.buildings.Count - 1].NSBMDFile = LoadModelTextures(b.NSBMDFile, romInfo.buildingTexturesDirPath, buildTextureComboBox.SelectedIndex - 1);
|
||||
|
||||
/* Add new entry to buildings ListBox */
|
||||
buildingsListBox.Items.Add((buildingsListBox.Items.Count + 1).ToString("D2") + nameSeparator +
|
||||
buildingsListBox.Items.Add((buildingsListBox.Items.Count + 1).ToString("D2") + Header.nameSeparator +
|
||||
buildIndexComboBox.Items[(int)b.modelID]);
|
||||
buildingsListBox.SelectedIndex = buildingsListBox.Items.Count - 1;
|
||||
|
||||
|
|
@ -2924,7 +2920,7 @@ namespace DSPRE {
|
|||
return;
|
||||
|
||||
disableHandlers = true;
|
||||
buildingsListBox.Items[buildingsListBox.SelectedIndex] = (buildingsListBox.SelectedIndex + 1).ToString("D2") + nameSeparator + buildIndexComboBox.SelectedItem;
|
||||
buildingsListBox.Items[buildingsListBox.SelectedIndex] = (buildingsListBox.SelectedIndex + 1).ToString("D2") + Header.nameSeparator + buildIndexComboBox.SelectedItem;
|
||||
disableHandlers = false;
|
||||
|
||||
currentMapFile.buildings[buildingsListBox.SelectedIndex].modelID = (uint)buildIndexComboBox.SelectedIndex;
|
||||
|
|
@ -3693,7 +3689,7 @@ namespace DSPRE {
|
|||
private void goToWarpDestination_Click(object sender, EventArgs e) {
|
||||
int destAnchor = (int)warpAnchorUpDown.Value;
|
||||
short destHeader = (short)warpHeaderUpDown.Value;
|
||||
ushort destEventID = Header.LoadFromARM9(destHeader).eventID;
|
||||
ushort destEventID = Header.LoadFromARM9(destHeader).eventFileID;
|
||||
EventFile destEvent = LoadEventFile(destEventID);
|
||||
|
||||
if (destEvent.warps.Count < destAnchor + 1) {
|
||||
|
|
@ -3702,14 +3698,14 @@ namespace DSPRE {
|
|||
if (d == DialogResult.No)
|
||||
return;
|
||||
else {
|
||||
eventMatrixUpDown.Value = Header.LoadFromARM9((short)warpHeaderUpDown.Value).matrix;
|
||||
eventMatrixUpDown.Value = Header.LoadFromARM9((short)warpHeaderUpDown.Value).matrixID;
|
||||
eventAreaDataUpDown.Value = Header.LoadFromARM9((short)warpHeaderUpDown.Value).areaDataID;
|
||||
selectEventComboBox.SelectedIndex = destEventID;
|
||||
centerEventviewOnEntities();
|
||||
return;
|
||||
}
|
||||
}
|
||||
eventMatrixUpDown.Value = Header.LoadFromARM9((short)warpHeaderUpDown.Value).matrix;
|
||||
eventMatrixUpDown.Value = Header.LoadFromARM9((short)warpHeaderUpDown.Value).matrixID;
|
||||
eventAreaDataUpDown.Value = Header.LoadFromARM9((short)warpHeaderUpDown.Value).areaDataID;
|
||||
selectEventComboBox.SelectedIndex = destEventID;
|
||||
warpsListBox.SelectedIndex = destAnchor;
|
||||
|
|
@ -6423,7 +6419,7 @@ namespace DSPRE {
|
|||
#endregion
|
||||
|
||||
private void headerSearchToolStripButton_Click(object sender, EventArgs e) {
|
||||
HeaderSearch h = new HeaderSearch(ref internalNames);
|
||||
HeaderSearch h = new HeaderSearch(ref internalNames, headerListBox);
|
||||
h.Show();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user