This commit is contained in:
Mixone-FinallyHere 2025-03-11 09:02:35 +01:00
parent 6b54bbea4f
commit 423dfdff6c
28 changed files with 4007 additions and 2961 deletions

View File

@ -0,0 +1,57 @@
name: DSPRE Canary Build
on:
push:
branches:
- main # Trigger only on pushes to the main branch
permissions:
contents: write
env:
SOLUTION_FILE_PATH: DS_Map.sln
BUILD_CONFIGURATION: Release
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v1.0.2
- name: Restore NuGet packages
working-directory: ${{env.GITHUB_WORKSPACE}}
run: nuget restore ${{env.SOLUTION_FILE_PATH}}
- name: Build DSPRE
working-directory: ${{env.GITHUB_WORKSPACE}}
run: msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} ${{env.SOLUTION_FILE_PATH}}
- name: Zip Release Files
run: Compress-Archive -Path ${{env.GITHUB_WORKSPACE}}DS_Map\bin\Release -DestinationPath DSPRE-canary.zip
- name: Fetch tags
run: git fetch --prune --unshallow --tags
- name: Delete previous release
run: |
gh release delete --yes canary
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
- name: Create new release
uses: softprops/action-gh-release@v2
with:
tag_name: canary
name: DSPRE Canary Build ${{ steps.date.outputs.date }}
files: DSPRE-canary.zip
token: ${{ secrets.GITHUB_TOKEN }}
prerelease: true
generate_release_notes: true

View File

@ -279,12 +279,11 @@
<Compile Include="ROMFiles\SafariZoneEncounterFile.cs" />
<Compile Include="ROMFiles\SafariZoneEncounterGroup.cs" />
<Compile Include="ROMFiles\SafariZoneObjectRequirement.cs" />
<Compile Include="ROMFiles\ScriptAction.cs" />
<Compile Include="ROMFiles\ScriptActionContainer.cs" />
<Compile Include="ROMFiles\ScriptCommand.cs" />
<Compile Include="ROMFiles\ScriptCommandContainer.cs" />
<Compile Include="ROMFiles\ScriptFile.cs" />
<Compile Include="ROMFiles\ScriptReference.cs" />
<Compile Include="Script\ScriptAction.cs" />
<Compile Include="Script\ScriptCommandPosition.cs" />
<Compile Include="Script\ScriptLabeledSection.cs" />
<Compile Include="Script\ScriptParameter.cs" />
<Compile Include="Script\ScriptReference.cs" />
<Compile Include="ROMFiles\SpeciesFile.cs" />
<Compile Include="ROMFiles\TrainerFile.cs" />
<Compile Include="ROMFiles\VariableValueTrigger.cs" />
@ -301,6 +300,7 @@
<DependentUpon>BuildingEditor.cs</DependentUpon>
</Compile>
<Compile Include="RomInfo.cs" />
<Compile Include="Script\ScriptCommand.cs" />
<Compile Include="ScintillaUtils\HotKeyManager.cs" />
<Compile Include="ScintillaUtils\ScriptTooltip.cs">
<SubType>Form</SubType>

View File

@ -42,6 +42,7 @@
this.moveInputComboBox = new DSPRE.InputComboBox();
this.statusLabel = new System.Windows.Forms.Label();
this.pokemonNameInputComboBox = new DSPRE.InputComboBox();
this.entryCountLabel = new System.Windows.Forms.Label();
this.tableLayoutPanel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pokemonPictureBox)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.monNumberNumericUpDown)).BeginInit();
@ -162,6 +163,7 @@
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.tableLayoutPanel3.Controls.Add(this.entryCountLabel, 0, 5);
this.tableLayoutPanel3.Controls.Add(this.descriptorLabel, 0, 1);
this.tableLayoutPanel3.Controls.Add(this.addMoveButton, 0, 4);
this.tableLayoutPanel3.Controls.Add(this.deleteMoveButton, 2, 4);
@ -179,9 +181,9 @@
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 34.50088F));
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 65.49912F));
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 165F));
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 38F));
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 11F));
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 144F));
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 44F));
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 26F));
this.tableLayoutPanel3.Size = new System.Drawing.Size(226, 357);
this.tableLayoutPanel3.TabIndex = 0;
//
@ -202,10 +204,10 @@
this.addMoveButton.Enabled = false;
this.addMoveButton.Image = global::DSPRE.Properties.Resources.addIcon;
this.addMoveButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.addMoveButton.Location = new System.Drawing.Point(4, 307);
this.addMoveButton.Location = new System.Drawing.Point(4, 286);
this.addMoveButton.Margin = new System.Windows.Forms.Padding(2);
this.addMoveButton.Name = "addMoveButton";
this.addMoveButton.Size = new System.Drawing.Size(70, 34);
this.addMoveButton.Size = new System.Drawing.Size(70, 40);
this.addMoveButton.TabIndex = 1;
this.addMoveButton.Text = "Add";
this.addMoveButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@ -218,10 +220,10 @@
this.deleteMoveButton.Enabled = false;
this.deleteMoveButton.Image = global::DSPRE.Properties.Resources.deleteIcon;
this.deleteMoveButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.deleteMoveButton.Location = new System.Drawing.Point(152, 307);
this.deleteMoveButton.Location = new System.Drawing.Point(152, 286);
this.deleteMoveButton.Margin = new System.Windows.Forms.Padding(2);
this.deleteMoveButton.Name = "deleteMoveButton";
this.deleteMoveButton.Size = new System.Drawing.Size(70, 34);
this.deleteMoveButton.Size = new System.Drawing.Size(70, 40);
this.deleteMoveButton.TabIndex = 2;
this.deleteMoveButton.Text = "Delete";
this.deleteMoveButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@ -234,10 +236,10 @@
this.editMoveButton.Enabled = false;
this.editMoveButton.Image = global::DSPRE.Properties.Resources.RenameIcon;
this.editMoveButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.editMoveButton.Location = new System.Drawing.Point(78, 307);
this.editMoveButton.Location = new System.Drawing.Point(78, 286);
this.editMoveButton.Margin = new System.Windows.Forms.Padding(2);
this.editMoveButton.Name = "editMoveButton";
this.editMoveButton.Size = new System.Drawing.Size(70, 34);
this.editMoveButton.Size = new System.Drawing.Size(70, 40);
this.editMoveButton.TabIndex = 3;
this.editMoveButton.Text = "Edit";
this.editMoveButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@ -285,7 +287,7 @@
this.statusLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.statusLabel.AutoSize = true;
this.tableLayoutPanel3.SetColumnSpan(this.statusLabel, 3);
this.statusLabel.Location = new System.Drawing.Point(5, 282);
this.statusLabel.Location = new System.Drawing.Point(5, 261);
this.statusLabel.Name = "statusLabel";
this.statusLabel.Padding = new System.Windows.Forms.Padding(1, 5, 1, 5);
this.statusLabel.Size = new System.Drawing.Size(39, 23);
@ -304,6 +306,19 @@
this.pokemonNameInputComboBox.TabIndex = 31;
this.pokemonNameInputComboBox.SelectedIndexChanged += new System.EventHandler(this.pokemonNameInputComboBox_SelectedIndexChanged);
//
// entryCountLabel
//
this.entryCountLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.entryCountLabel.AutoSize = true;
this.tableLayoutPanel3.SetColumnSpan(this.entryCountLabel, 3);
this.entryCountLabel.Location = new System.Drawing.Point(5, 332);
this.entryCountLabel.Name = "entryCountLabel";
this.entryCountLabel.Padding = new System.Windows.Forms.Padding(1, 5, 1, 5);
this.entryCountLabel.Size = new System.Drawing.Size(70, 23);
this.entryCountLabel.TabIndex = 9;
this.entryCountLabel.Text = "Entry Count: ";
this.entryCountLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// LearnsetEditor
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -349,5 +364,6 @@
private System.Windows.Forms.Label statusLabel;
public InputComboBox pokemonNameInputComboBox;
public System.Windows.Forms.NumericUpDown monNumberNumericUpDown;
private System.Windows.Forms.Label entryCountLabel;
}
}

View File

@ -2,11 +2,9 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Windows;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using static ScintillaNET.Style;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.TextBox;
using MessageBox = System.Windows.Forms.MessageBox;
namespace DSPRE {
@ -30,8 +28,8 @@ namespace DSPRE {
private int currentLoadedId = 0;
private LearnsetData currentLoadedFile = null;
private static bool dirty = false;
private static readonly string formName = "Learnset Editor";
private bool dirty = false;
private readonly string formName = "Learnset Editor";
public LearnsetEditor(string[] moveNames, Control parent, PokemonEditor pokeEditor) {
this.moveNames = moveNames;
@ -117,6 +115,8 @@ namespace DSPRE {
foreach (var elem in currentLoadedFile.list) {
movesListBox.Items.Add(ElemToString(elem));
}
UpdateEntryCountLabel();
movesListBox.EndUpdate();
}
@ -231,6 +231,8 @@ namespace DSPRE {
if (count > 0) {
movesListBox.SelectedIndex = Math.Max(0, sel - 1);
}
UpdateEntryCountLabel();
}
UpdateByEditMode();
@ -259,6 +261,7 @@ namespace DSPRE {
newSelection = currentLoadedFile.list.FindIndex(x => x == newEntry);
}
UpdateEntryCountLabel();
movesListBox.SelectedIndex = newSelection;
editMode = false;
movesListBox.Enabled = true;
@ -273,6 +276,7 @@ namespace DSPRE {
moveInputComboBox.SelectedIndex = move;
levelNumericUpDown.Value = level;
}
UpdateByEditMode();
addMoveButton.Enabled = (editMode == false && CheckValidEntry());
setDirty(true);
@ -303,5 +307,21 @@ namespace DSPRE {
editMoveButton.Enabled = true;
deleteMoveButton.Enabled = true;
}
private void UpdateEntryCountLabel(){
StringBuilder labelText = new StringBuilder("Entry Count: ");
labelText.Append(movesListBox.Items.Count);
if (movesListBox.Items.Count > LearnsetData.VanillaLimit) {
labelText.Append("!");
entryCountLabel.ForeColor = Color.FromArgb(210, 120, 0);
entryCountLabel.Font = new Font(entryCountLabel.Font, FontStyle.Bold);
} else {
entryCountLabel.ForeColor = Color.Black;
entryCountLabel.Font = new Font(entryCountLabel.Font, FontStyle.Regular);
}
entryCountLabel.Text = labelText.ToString();
}
}
}

View File

@ -23,6 +23,7 @@
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PokemonEditor));
this.tabControl = new System.Windows.Forms.TabControl();
this.personalPage = new System.Windows.Forms.TabPage();
this.learnsetPage = new System.Windows.Forms.TabPage();
@ -65,7 +66,7 @@
this.learnsetPage.Location = new System.Drawing.Point(4, 22);
this.learnsetPage.Name = "learnsetPage";
this.learnsetPage.Padding = new System.Windows.Forms.Padding(3);
this.learnsetPage.Size = new System.Drawing.Size(1024, 534);
this.learnsetPage.Size = new System.Drawing.Size(1024, 526);
this.learnsetPage.TabIndex = 1;
this.learnsetPage.Text = "Learnset Editor";
this.learnsetPage.UseVisualStyleBackColor = true;
@ -75,7 +76,7 @@
this.evoPage.Location = new System.Drawing.Point(4, 22);
this.evoPage.Name = "evoPage";
this.evoPage.Padding = new System.Windows.Forms.Padding(3);
this.evoPage.Size = new System.Drawing.Size(1024, 534);
this.evoPage.Size = new System.Drawing.Size(1024, 526);
this.evoPage.TabIndex = 2;
this.evoPage.Text = "Evolution Editor";
this.evoPage.UseVisualStyleBackColor = true;
@ -86,24 +87,24 @@
this.syncChangesCheckbox.Dock = System.Windows.Forms.DockStyle.Bottom;
this.syncChangesCheckbox.Location = new System.Drawing.Point(3, 3);
this.syncChangesCheckbox.Name = "syncChangesCheckbox";
this.syncChangesCheckbox.Size = new System.Drawing.Size(171, 17);
this.syncChangesCheckbox.Size = new System.Drawing.Size(177, 17);
this.syncChangesCheckbox.TabIndex = 1;
this.syncChangesCheckbox.Text = "Synchronize Chosen Pokemon";
this.syncChangesCheckbox.Text = "Synchronize Pokémon selection";
this.syncChangesCheckbox.UseVisualStyleBackColor = true;
//
// syncChangesLabel
//
this.syncChangesLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.syncChangesLabel.AutoSize = true;
this.syncChangesLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.syncChangesLabel.Dock = System.Windows.Forms.DockStyle.Bottom;
this.syncChangesLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.syncChangesLabel.ForeColor = System.Drawing.SystemColors.Highlight;
this.syncChangesLabel.Location = new System.Drawing.Point(177, 5);
this.syncChangesLabel.Margin = new System.Windows.Forms.Padding(0);
this.syncChangesLabel.Location = new System.Drawing.Point(186, 10);
this.syncChangesLabel.Name = "syncChangesLabel";
this.syncChangesLabel.Size = new System.Drawing.Size(472, 13);
this.syncChangesLabel.Size = new System.Drawing.Size(433, 13);
this.syncChangesLabel.TabIndex = 2;
this.syncChangesLabel.Text = "When this CheckBox is marked, all changes in any tab will be synchronized accross" +
" the other tabs.";
this.syncChangesLabel.Text = "When this CheckBox is marked, mon selection will be synchronized accross all tabs" +
" below.";
//
// flowLayoutPanel1
//
@ -135,8 +136,9 @@
this.Controls.Add(this.flowLayoutPanel1);
this.Controls.Add(this.tabControl);
this.DoubleBuffered = true;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "PokemonEditor";
this.Text = "PokemonEditor";
this.Text = "Pokémon Editor";
this.tabControl.ResumeLayout(false);
this.flowLayoutPanel1.ResumeLayout(false);
this.flowLayoutPanel1.PerformLayout();

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -13,14 +13,8 @@ using System.Globalization;
namespace DSPRE.Editors {
public partial class ScriptEditor : UserControl {
public bool scriptEditorIsReady { get; set; } = false;
private Scintilla ScriptTextArea;
private Scintilla FunctionTextArea;
private Scintilla ActionTextArea;
private SearchManager scriptSearchManager;
private SearchManager functionSearchManager;
private SearchManager actionSearchManager;
private Scintilla currentScintillaEditor;
private SearchManager currentSearchManager;
private Scintilla ScriptTextArea;
private bool scriptsDirty = false;
private bool functionsDirty = false;
private bool actionsDirty = false;
@ -118,7 +112,6 @@ namespace DSPRE.Editors {
public void OpenScriptEditor(MainProgram parent, int scriptFileID) {
SetupScriptEditor(parent);
scriptEditorTabControl.SelectedIndex = 0;
selectScriptFileComboBox.SelectedIndex = scriptFileID;
EditorPanels.mainTabControl.SelectedTab = EditorPanels.scriptEditorTabPage;
}
@ -132,9 +125,6 @@ namespace DSPRE.Editors {
secondaryKeyWords = String.Join(" ", RomInfo.ScriptComparisonOperatorsDict.Values) +
" " + String.Join(" ", ScriptDatabase.specialOverworlds.Values) +
" " + String.Join(" ", ScriptDatabase.overworldDirections.Values) +
" " + ScriptFile.ContainerTypes.Script.ToString() +
" " + ScriptFile.ContainerTypes.Function.ToString() +
" " + ScriptFile.ContainerTypes.Action.ToString() +
" " + Event.EventType.Overworld +
" " + Overworld.MovementCodeKW;
secondaryKeyWords += " " + secondaryKeyWords.ToUpper() + " " + secondaryKeyWords.ToLower();
@ -145,52 +135,25 @@ namespace DSPRE.Editors {
scintillaScriptsPanel.Controls.Clear();
scintillaScriptsPanel.Controls.Add(ScriptTextArea);
FunctionTextArea = new Scintilla();
functionSearchManager = new SearchManager(EditorPanels.MainProgram, FunctionTextArea, panelFindFunctionTextBox, PanelSearchFunctions);
scintillaFunctionsPanel.Controls.Clear();
scintillaFunctionsPanel.Controls.Add(FunctionTextArea);
ActionTextArea = new Scintilla();
actionSearchManager = new SearchManager(EditorPanels.MainProgram, ActionTextArea, panelFindActionTextBox, PanelSearchActions);
scintillaActionsPanel.Controls.Clear();
scintillaActionsPanel.Controls.Add(ActionTextArea);
currentScintillaEditor = ScriptTextArea;
currentSearchManager = scriptSearchManager;
// BASIC CONFIG
ScriptTextArea.TextChanged += (OnTextChangedScript);
FunctionTextArea.TextChanged += (OnTextChangedFunction);
ActionTextArea.TextChanged += (OnTextChangedAction);
// INITIAL VIEW CONFIG
InitialViewConfig(ScriptTextArea);
InitialViewConfig(FunctionTextArea);
InitialViewConfig(ActionTextArea);
InitSyntaxColoring(ScriptTextArea);
InitSyntaxColoring(FunctionTextArea);
InitSyntaxColoring(ActionTextArea);
// NUMBER MARGIN
InitNumberMargin(ScriptTextArea, ScriptTextArea_MarginClick);
InitNumberMargin(FunctionTextArea, FunctionTextArea_MarginClick);
InitNumberMargin(ActionTextArea, ActionTextArea_MarginClick);
// BOOKMARK MARGIN
InitBookmarkMargin(ScriptTextArea);
InitBookmarkMargin(FunctionTextArea);
InitBookmarkMargin(ActionTextArea);
// CODE FOLDING MARGIN
InitCodeFolding(ScriptTextArea);
InitCodeFolding(FunctionTextArea);
InitCodeFolding(ActionTextArea);
// INIT HOTKEYS
InitHotkeys(ScriptTextArea, scriptSearchManager);
InitHotkeys(FunctionTextArea, functionSearchManager);
InitHotkeys(ActionTextArea, actionSearchManager);
// INIT TOOLTIPS DWELLING
/*
@ -202,6 +165,8 @@ namespace DSPRE.Editors {
FunctionTextArea.DwellEnd += TextArea_DwellEnd;
FunctionTextArea.DwellStart += TextArea_DwellStart;
*/
// Style for prefixed words (label_*, script_*)
}
private void populate_selectScriptFileComboBox(int selectedIndex = 0) {
@ -227,7 +192,6 @@ namespace DSPRE.Editors {
}
private void InitSyntaxColoring(Scintilla textArea) {
// Configure the default style
textArea.StyleResetDefault();
textArea.Styles[Style.Default].Font = "Consolas";
textArea.Styles[Style.Default].Size = 12;
@ -235,20 +199,74 @@ namespace DSPRE.Editors {
textArea.Styles[Style.Default].ForeColor = Color.FromArgb(0xFFFFFF);
textArea.StyleClearAll();
// Configure the lexer styles
textArea.Styles[Style.Python.Identifier].ForeColor = Color.FromArgb(0xD0DAE2);
textArea.Styles[Style.Python.CommentLine].ForeColor = Color.FromArgb(0x40BF57);
textArea.Styles[Style.Python.Number].ForeColor = Color.FromArgb(0xFFFF00);
textArea.Styles[Style.Python.String].ForeColor = Color.FromArgb(0xFF00FF);
textArea.Styles[Style.Python.Character].ForeColor = Color.FromArgb(0xE95454);
textArea.Styles[Style.Python.Operator].ForeColor = Color.FromArgb(0xFFFF00);
textArea.Styles[Style.Python.Word].ForeColor = Color.FromArgb(0x48A8EE);
textArea.Styles[Style.Python.Word2].ForeColor = Color.FromArgb(0xF98906);
// Configure Assembly lexer styles
textArea.Styles[Style.Asm.Identifier].ForeColor = Color.FromArgb(0xD0DAE2);
textArea.Styles[Style.Asm.Number].ForeColor = Color.FromArgb(0xFFFF00);
textArea.Styles[Style.Asm.String].ForeColor = Color.FromArgb(0xFF00FF);
textArea.Styles[Style.Asm.Character].ForeColor = Color.FromArgb(0xE95454);
textArea.Styles[Style.Asm.Operator].ForeColor = Color.FromArgb(0xFFFF00);
textArea.Styles[Style.Asm.Comment].ForeColor = Color.FromArgb(0x40BF57);
textArea.Lexer = Lexer.Python;
// For command keywords - use CpuInstruction style
textArea.Styles[Style.Asm.CpuInstruction].ForeColor = Color.FromArgb(0x48A8EE);
textArea.SetKeywords(0, cmdKeyWords);
textArea.SetKeywords(1, secondaryKeyWords);
// For secondary keywords - use Directive style
textArea.Styles[Style.Asm.Directive].ForeColor = Color.FromArgb(0xF98906);
// Configure indicators for prefix highlighting
textArea.Indicators[0].Style = IndicatorStyle.TextFore;
textArea.Indicators[0].ForeColor = Color.FromArgb(0x8A2BE2); // Purple for label_*
textArea.Indicators[0].Under = false; // Draw over the lexer's styling
textArea.Indicators[1].Style = IndicatorStyle.TextFore;
textArea.Indicators[1].ForeColor = Color.FromArgb(0x00CED1); // Cyan for script_*
textArea.Indicators[1].Under = false; // Draw over the lexer's styling
// Set the lexer and keywords
textArea.Lexer = Lexer.Asm;
textArea.SetKeywords(0, cmdKeyWords); // CPU Instructions index
textArea.SetKeywords(3, secondaryKeyWords); // Directives index
// Apply the highlighting
textArea.TextChanged += (sender, e) => HighlightPrefixedWords(textArea);
// Initial highlighting
HighlightPrefixedWords(textArea);
}
private void HighlightPrefixedWords(Scintilla textArea) {
// Clear existing indicators
textArea.IndicatorCurrent = 0;
textArea.IndicatorClearRange(0, textArea.TextLength);
textArea.IndicatorCurrent = 1;
textArea.IndicatorClearRange(0, textArea.TextLength);
// Process each line individually
for (int i = 0; i < textArea.Lines.Count; i++) {
string lineText = textArea.Lines[i].Text;
int linePos = textArea.Lines[i].Position;
// Trim for detection but use original text for positions
string trimmedLine = lineText.Trim();
// Handle script_ lines
if (trimmedLine.Contains("script_") && trimmedLine.EndsWith(":")) {
int startPos = linePos + lineText.IndexOf("script_");
int endPos = linePos + lineText.IndexOf(":", lineText.IndexOf("script_")) + 1;
textArea.IndicatorCurrent = 1;
textArea.IndicatorFillRange(startPos, endPos - startPos);
}
// Handle label_ lines
if (trimmedLine.Contains("label_") && trimmedLine.EndsWith(":")) {
int startPos = linePos + lineText.IndexOf("label_");
int endPos = linePos + lineText.IndexOf(":", lineText.IndexOf("label_")) + 1;
textArea.IndicatorCurrent = 0;
textArea.IndicatorFillRange(startPos, endPos - startPos);
}
}
}
private void InitNumberMargin(Scintilla textArea, EventHandler<MarginClickEventArgs> textArea_MarginClick) {
@ -372,10 +390,8 @@ namespace DSPRE.Editors {
private void ScriptEditorSetClean() {
Helpers.DisableHandlers();
scriptsTabPage.Text = ScriptFile.ContainerTypes.Script.ToString() + "s";
functionsTabPage.Text = ScriptFile.ContainerTypes.Function.ToString() + "s";
actionsTabPage.Text = ScriptFile.ContainerTypes.Action.ToString() + "s";
scriptsDirty = functionsDirty = actionsDirty = false;
//scriptsTabPage.Text = ScriptFile.ContainerTypes.Script.ToString() + "s";
scriptsDirty = false;
Helpers.EnableHandlers();
}
@ -383,33 +399,13 @@ namespace DSPRE.Editors {
private void OnTextChangedScript(object sender, EventArgs e) {
ScriptTextArea.Margins[NUMBER_MARGIN].Width = ScriptTextArea.Lines.Count.ToString().Length * 13;
scriptsDirty = true;
scriptsTabPage.Text = ScriptFile.ContainerTypes.Script.ToString() + "s" + "*";
}
private void OnTextChangedFunction(object sender, EventArgs e) {
FunctionTextArea.Margins[NUMBER_MARGIN].Width = FunctionTextArea.Lines.Count.ToString().Length * 13;
functionsDirty = true;
functionsTabPage.Text = ScriptFile.ContainerTypes.Function.ToString() + "s" + "*";
}
private void OnTextChangedAction(object sender, EventArgs e) {
ActionTextArea.Margins[NUMBER_MARGIN].Width = ActionTextArea.Lines.Count.ToString().Length * 13;
actionsDirty = true;
actionsTabPage.Text = ScriptFile.ContainerTypes.Action.ToString() + "s" + "*";
//scriptsTabPage.Text = ScriptFile.ContainerTypes.Script.ToString() + "s" + "*";
}
private void ScriptTextArea_MarginClick(object sender, MarginClickEventArgs e) {
MarginClick(ScriptTextArea, e);
}
private void FunctionTextArea_MarginClick(object sender, MarginClickEventArgs e) {
MarginClick(FunctionTextArea, e);
}
private void ActionTextArea_MarginClick(object sender, MarginClickEventArgs e) {
MarginClick(ActionTextArea, e);
}
private void MarginClick(Scintilla textArea, MarginClickEventArgs e) {
if (e.Margin == BOOKMARK_MARGIN) {
// Do we have a marker for this line?
@ -480,12 +476,12 @@ namespace DSPRE.Editors {
return false;
}
// Keep all the code that handles unsaved changes
if (scriptsDirty || functionsDirty || actionsDirty) {
DialogResult d = MessageBox.Show("There are unsaved changes in this Script File.\nDo you wish to discard them?", "Unsaved work", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
if (!d.Equals(DialogResult.Yes)) {
Helpers.DisableHandlers();
// selectScriptFileComboBox.SelectedItem = currentScriptFile;
selectScriptFileComboBox.SelectedIndex = (int)currentScriptFile.fileID;
Helpers.EnableHandlers();
return false;
@ -495,18 +491,13 @@ namespace DSPRE.Editors {
Helpers.DisableHandlers();
ScriptFile lastScriptFile = currentScriptFile;
// currentScriptFile = (ScriptFile)selectScriptFileComboBox.SelectedItem;
currentScriptFile = new ScriptFile(selectScriptFileComboBox.SelectedIndex); // Load script file
// Load the script file using our new label-based constructor
currentScriptFile = new ScriptFile(selectScriptFileComboBox.SelectedIndex);
// Clear only the script text area and nav listbox
ScriptTextArea.ClearAll();
FunctionTextArea.ClearAll();
ActionTextArea.ClearAll();
scriptsNavListbox.Items.Clear();
functionsNavListbox.Items.Clear();
actionsNavListbox.Items.Clear();
//prevent buttons from flickering when the combobox selection changes
bool typeChanged = true;
if (lastScriptFile != null) {
typeChanged = lastScriptFile.isLevelScript != currentScriptFile.isLevelScript;
@ -545,9 +536,7 @@ namespace DSPRE.Editors {
}
if (!currentScriptFile.isLevelScript) {
displayScriptFile(ScriptFile.ContainerTypes.Script, currentScriptFile.allScripts, scriptsNavListbox, ScriptTextArea);
displayScriptFile(ScriptFile.ContainerTypes.Function, currentScriptFile.allFunctions, functionsNavListbox, FunctionTextArea);
displayScriptFileActions(ScriptFile.ContainerTypes.Action, currentScriptFile.allActions, actionsNavListbox, ActionTextArea);
displayScriptFile(scriptsNavListbox, ScriptTextArea);
}
ScriptEditorSetClean();
@ -558,84 +547,35 @@ namespace DSPRE.Editors {
return true;
}
static void displayScriptFile(ScriptFile.ContainerTypes containerType, List<ScriptCommandContainer> commandList, ListBox navListBox, Scintilla textArea) {
string buffer = "";
/* Add commands */
for (int i = 0; i < commandList.Count; i++) {
ScriptCommandContainer scriptCommandContainer = commandList[i];
/* Write header */
string header = containerType + " " + (i + 1);
buffer += header + ':' + Environment.NewLine;
navListBox.Items.Add(header);
/* If current command is identical to another, print UseScript instead of commands */
if (scriptCommandContainer.usedScriptID < 0) {
for (int j = 0; j < scriptCommandContainer.commands.Count; j++) {
ScriptCommand command = scriptCommandContainer.commands[j];
if (!ScriptDatabase.endCodes.Contains(command.id)) {
buffer += '\t';
}
buffer += command.name + Environment.NewLine;
}
} else {
buffer += '\t' + "UseScript_#" + scriptCommandContainer.usedScriptID + Environment.NewLine;
}
textArea.AppendText(buffer + Environment.NewLine);
buffer = "";
private void displayScriptFile(ListBox navListBox, Scintilla textArea) {
if (currentScriptFile.CommandSequence == null || currentScriptFile.CommandSequence.Count == 0) {
return;
}
}
static void displayScriptFileActions(ScriptFile.ContainerTypes containerType, List<ScriptActionContainer> commandList, ListBox navListBox, Scintilla textArea) {
/* Add movements */
string buffer = "";
for (int i = 0; i < commandList.Count; i++) {
ScriptActionContainer currentCommand = commandList[i];
string header = containerType + " " + (i + 1);
buffer += header + ':' + Environment.NewLine;
navListBox.Items.Add(header);
for (int j = 0; j < currentCommand.commands.Count; j++) {
ScriptAction command = currentCommand.commands[j];
if (!ScriptDatabase.movementEndCodes.Contains(command.id)) {
buffer += '\t';
}
buffer += command.name + Environment.NewLine;
// First add all labels to the nav listbox
HashSet<string> addedLabels = new HashSet<string>();
foreach (var cmdPos in currentScriptFile.CommandSequence) {
if (!string.IsNullOrEmpty(cmdPos.Label) && !addedLabels.Contains(cmdPos.Label)) {
navListBox.Items.Add(cmdPos.Label);
addedLabels.Add(cmdPos.Label);
}
textArea.AppendText(buffer + Environment.NewLine);
buffer = "";
}
// Generate the script text
string scriptText = currentScriptFile.ToText();
textArea.Text = scriptText;
}
private void scriptEditorZoomInButton_Click(object sender, EventArgs e) {
ZoomIn(currentScintillaEditor);
ZoomIn(ScriptTextArea);
}
private void scriptEditorZoomOutButton_Click(object sender, EventArgs e) {
ZoomOut(currentScintillaEditor);
ZoomOut(ScriptTextArea);
}
private void scriptEditorZoomResetButton_Click(object sender, EventArgs e) {
ZoomDefault(currentScintillaEditor);
}
private void scriptEditorTabControl_TabIndexChanged(object sender, EventArgs e) {
if (scriptEditorTabControl.SelectedTab == scriptsTabPage) {
currentSearchManager = scriptSearchManager;
currentScintillaEditor = ScriptTextArea;
} else if (scriptEditorTabControl.SelectedTab == functionsTabPage) {
currentSearchManager = functionSearchManager;
currentScintillaEditor = FunctionTextArea;
} else {
//Actions
currentSearchManager = actionSearchManager;
currentScintillaEditor = ActionTextArea;
}
ZoomDefault(ScriptTextArea);
}
private void removeScriptFileButton_Click(object sender, EventArgs e) {
@ -660,18 +600,20 @@ namespace DSPRE.Editors {
/* Add new event file to event folder */
int fileID = selectScriptFileComboBox.Items.Count;
ScriptFile scriptFile = new ScriptFile(
scriptLines: new Scintilla { Text = "Script 1:\nEnd" }.Lines.ToStringsList(trim: true),
functionLines: null,
actionLines: null,
fileID
);
// Create a simple script with one labeled section
List<string> scriptLines = new List<string> {
"script_0:",
"\tEnd"
};
//check if ScriptFile instance was created successfully
// Use the new constructor that just takes script lines
ScriptFile scriptFile = new ScriptFile(scriptLines, fileID);
// Check if ScriptFile instance was created successfully
if (scriptFile.SaveToFileDefaultDir(fileID, showSuccessMessage: false)) {
/* Update ComboBox and select new file */
selectScriptFileComboBox.Items.Add(scriptFile);
selectScriptFileComboBox.SelectedItem = scriptFile;
selectScriptFileComboBox.Items.Add($"Script File {fileID}");
selectScriptFileComboBox.SelectedIndex = selectScriptFileComboBox.Items.Count - 1;
}
}
@ -679,19 +621,13 @@ namespace DSPRE.Editors {
/* Create new ScriptFile object using the values in the script editor */
int fileID = currentScriptFile.fileID;
// We only need the script text area now, not function or action areas
ScriptFile userEdited = new ScriptFile(
scriptLines: ScriptTextArea.Lines.ToStringsList(trim: true),
functionLines: FunctionTextArea.Lines.ToStringsList(trim: true),
actionLines: ActionTextArea.Lines.ToStringsList(trim: true),
fileID
ScriptTextArea.Lines.ToStringsList(trim: true),
fileID
);
if (userEdited.hasNoScripts) {
MessageBox.Show("This " + nameof(ScriptFile) + " couldn't be saved. A minimum of one script is required.", "Can't save", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
//check if ScriptFile instance was created successfully
// Check if ScriptFile instance was created successfully
if (userEdited.SaveToFileDefaultDir(fileID)) {
currentScriptFile = userEdited;
ScriptEditorSetClean();
@ -779,98 +715,54 @@ namespace DSPRE.Editors {
scriptSearchManager.CloseSearch();
}
private void BtnNextFindFunc_Click(object sender, EventArgs e) {
findNext(functionSearchManager);
}
private void BtnPrevFindFunc_Click(object sender, EventArgs e) {
findNext(functionSearchManager);
}
private void panelFindFunctionTextBox_TextChanged(object sender, EventArgs e) {
findNext(functionSearchManager);
}
private void functionTxtFind_KeyDown(object sender, KeyEventArgs e) {
TxtFindKeyDown(functionSearchManager, e);
}
private void BtnCloseFindFunc_Click(object sender, EventArgs e) {
functionSearchManager.CloseSearch();
}
private void BtnNextFindActions_Click(object sender, EventArgs e) {
findNext(actionSearchManager);
}
private void BtnPrevFindActions_Click(object sender, EventArgs e) {
findNext(actionSearchManager);
}
private void panelFindActionTextBox_TextChanged(object sender, EventArgs e) {
findNext(actionSearchManager);
}
private void actionTxtFind_KeyDown(object sender, KeyEventArgs e) {
TxtFindKeyDown(actionSearchManager, e);
}
private void BtnCloseFindActions_Click(object sender, EventArgs e) {
actionSearchManager.CloseSearch();
}
void scrollResultToTop(SearchManager searchManager) {
int resultStart = searchManager.textAreaScintilla.CurrentLine - ScriptEditorSearchResult.ResultsPadding;
searchManager.textAreaScintilla.FirstVisibleLine = resultStart;
}
private void NavigatorGoTo(ListBox listBox, TabPage tabPage, SearchManager searchManager, ScriptFile.ContainerTypes containerType) {
private void NavigatorGoTo(ListBox listBox, ScriptFile.ContainerTypes containerType) {
if (listBox.SelectedIndex < 0) {
return;
}
scriptEditorTabControl.SelectedTab = tabPage;
int commandNumber = listBox.SelectedIndex + 1;
string CommandBlockOpen = $"{containerType} {commandNumber}:";
searchManager.Find(true, false, CommandBlockOpen);
scriptSearchManager.Find(true, false, CommandBlockOpen);
scrollResultToTop(searchManager);
scrollResultToTop(scriptSearchManager);
}
private void scriptsNavListbox_SelectedIndexChanged(object sender, EventArgs e) {
NavigatorGoTo((ListBox)sender, scriptsTabPage, scriptSearchManager, ScriptFile.ContainerTypes.Script);
NavigatorGoTo((ListBox)sender, ScriptFile.ContainerTypes.Script);
}
private void functionsNavListbox_SelectedIndexChanged(object sender, EventArgs e) {
NavigatorGoTo((ListBox)sender, functionsTabPage, functionSearchManager, ScriptFile.ContainerTypes.Function);
//NavigatorGoTo((ListBox)sender, functionsTabPage, functionSearchManager, ScriptFile.ContainerTypes.Function);
}
private void actionsNavListbox_SelectedIndexChanged(object sender, EventArgs e) {
NavigatorGoTo((ListBox)sender, actionsTabPage, actionSearchManager, ScriptFile.ContainerTypes.Action);
//NavigatorGoTo((ListBox)sender, actionsTabPage, actionSearchManager, ScriptFile.ContainerTypes.Action);
}
private void openFindScriptEditorButton_Click(object sender, EventArgs e) {
currentSearchManager.OpenSearch();
scriptSearchManager.OpenSearch();
}
private void ScriptEditorExpandButton_Click(object sender, EventArgs e) {
currentScintillaEditor.FoldAll(FoldAction.Expand);
ScriptTextArea.FoldAll(FoldAction.Expand);
}
private void ScriptEditorCollapseButton_Click(object sender, EventArgs e) {
currentScintillaEditor.FoldAll(FoldAction.Contract);
ScriptTextArea.FoldAll(FoldAction.Contract);
}
private void scriptEditorWordWrapCheckbox_CheckedChanged(object sender, EventArgs e) {
ScriptTextArea.WrapMode = scriptEditorWordWrapCheckbox.Checked ? WrapMode.Word : WrapMode.None;
FunctionTextArea.WrapMode = scriptEditorWordWrapCheckbox.Checked ? WrapMode.Word : WrapMode.None;
ActionTextArea.WrapMode = scriptEditorWordWrapCheckbox.Checked ? WrapMode.Word : WrapMode.None;
}
private void viewWhiteSpacesButton_Click(object sender, EventArgs e) {
ScriptTextArea.ViewWhitespace = scriptEditorWhitespacesCheckbox.Checked ? WhitespaceMode.VisibleAlways : WhitespaceMode.Invisible;
FunctionTextArea.ViewWhitespace = scriptEditorWhitespacesCheckbox.Checked ? WhitespaceMode.VisibleAlways : WhitespaceMode.Invisible;
ActionTextArea.ViewWhitespace = scriptEditorWhitespacesCheckbox.Checked ? WhitespaceMode.VisibleAlways : WhitespaceMode.Invisible;
}
private void searchInScriptsTextBox_KeyDown(object sender, KeyEventArgs e) {
@ -925,17 +817,20 @@ namespace DSPRE.Editors {
List<ScriptFile> scriptsToSearch = getScriptsToSearch();
string searchString = searchInScriptsTextBox.Text;
Func<string, bool> searchCriteriaCS = (string s) => s.IndexOf(searchString, StringComparison.InvariantCulture) >= 0;
Func<string, bool> searchCriteriaCI = (string s) => s.IndexOf(searchString, StringComparison.InvariantCultureIgnoreCase) >= 0;
Func<string, bool> searchCriteria = scriptSearchCaseSensitiveCheckBox.Checked ? searchCriteriaCS : searchCriteriaCI;
bool searchCriteriaCS(string s) => s.IndexOf(searchString, StringComparison.InvariantCulture) >= 0;
bool searchCriteriaCI(string s) => s.IndexOf(searchString, StringComparison.InvariantCultureIgnoreCase) >= 0;
Func<string, bool> searchCriteria;
if (scriptSearchCaseSensitiveCheckBox.Checked) {
searchCriteria = searchCriteriaCS;
} else {
searchCriteria = searchCriteriaCI;
}
List<ScriptEditorSearchResult> results = new List<ScriptEditorSearchResult>();
foreach (ScriptFile scriptFile in scriptsToSearch) {
List<ScriptEditorSearchResult> scriptResults = SearchInScripts(scriptFile, scriptFile.allScripts, searchCriteria);
List<ScriptEditorSearchResult> functionResults = SearchInScripts(scriptFile, scriptFile.allFunctions, searchCriteria);
// List<ScriptEditorSearchResult> actionResults = SearchInScripts(scriptFile, scriptFile.allActions, searchCriteria);
List<ScriptEditorSearchResult> scriptResults = SearchInScripts(scriptFile, searchCriteria);
results.AddRange(scriptResults);
results.AddRange(functionResults);
// results.AddRange(actionResults);
}
@ -948,21 +843,9 @@ namespace DSPRE.Editors {
bw.RunWorkerAsync();
}
private List<ScriptEditorSearchResult> SearchInScripts(ScriptFile scriptFile, List<ScriptCommandContainer> commandContainers, Func<string, bool> criteria) {
private List<ScriptEditorSearchResult> SearchInScripts(ScriptFile scriptFile, Func<string, bool> criteria) {
List<ScriptEditorSearchResult> results = new List<ScriptEditorSearchResult>();
for (int j = 0; j < commandContainers.Count; j++) {
if (commandContainers[j].commands is null) {
continue;
}
ScriptCommandContainer scriptCommandContainer = commandContainers[j];
foreach (ScriptCommand scriptCommand in scriptCommandContainer.commands) {
if (criteria(scriptCommand.name)) {
results.Add(new ScriptEditorSearchResult(scriptFile, scriptCommandContainer.containerType, j + 1, scriptCommand));
}
}
}
return results;
}
@ -987,19 +870,11 @@ namespace DSPRE.Editors {
selectScriptFileComboBox.SelectedIndex = scriptFile.fileID;
if (containerType == ScriptFile.ContainerTypes.Script) {
displaySearchResult(scriptsTabPage, scriptSearchManager, searchResult);
} else if (containerType == ScriptFile.ContainerTypes.Function) {
displaySearchResult(functionsTabPage, functionSearchManager, searchResult);
} else if (containerType == ScriptFile.ContainerTypes.Action) {
displaySearchResult(actionsTabPage, actionSearchManager, searchResult);
displaySearchResult(scriptSearchManager, searchResult);
}
}
private void displaySearchResult(TabPage tabPage, SearchManager searchManager, ScriptEditorSearchResult searchResult) {
if (scriptEditorTabControl.SelectedTab != tabPage) {
scriptEditorTabControl.SelectedTab = tabPage;
}
private void displaySearchResult(SearchManager searchManager, ScriptEditorSearchResult searchResult) {
searchManager.Find(true, false, searchResult.CommandBlockOpen);
int blockStart = searchManager.textAreaScintilla.CurrentLine - ScriptEditorSearchResult.ResultsPadding;

View File

@ -30,22 +30,22 @@
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainProgram));
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle17 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle18 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle19 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle20 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle21 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle22 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle23 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle24 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle25 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle26 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle27 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle28 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle29 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle30 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle31 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle32 = new System.Windows.Forms.DataGridViewCellStyle();
this.mainTabControl = new System.Windows.Forms.TabControl();
this.headerEditorTabPage = new System.Windows.Forms.TabPage();
this.removeLastHeaderBTN = new System.Windows.Forms.Button();
@ -856,7 +856,6 @@
this.weatherMapEditor = new System.Windows.Forms.ToolStripButton();
this.versionLabel = new System.Windows.Forms.Label();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.exportScriptDatabaseJSONToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.mainTabControl.SuspendLayout();
this.headerEditorTabPage.SuspendLayout();
this.worldmapCoordsGroupBox.SuspendLayout();
@ -2590,7 +2589,7 @@
//
this.resetColorTableButton.Image = global::DSPRE.Properties.Resources.resetColorTable;
this.resetColorTableButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.resetColorTableButton.Location = new System.Drawing.Point(11, 446);
this.resetColorTableButton.Location = new System.Drawing.Point(11, 451);
this.resetColorTableButton.Name = "resetColorTableButton";
this.resetColorTableButton.Size = new System.Drawing.Size(117, 32);
this.resetColorTableButton.TabIndex = 31;
@ -2603,7 +2602,7 @@
//
this.importColorTableButton.Image = global::DSPRE.Properties.Resources.loadColorTable;
this.importColorTableButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.importColorTableButton.Location = new System.Drawing.Point(11, 479);
this.importColorTableButton.Location = new System.Drawing.Point(11, 484);
this.importColorTableButton.Name = "importColorTableButton";
this.importColorTableButton.Size = new System.Drawing.Size(117, 32);
this.importColorTableButton.TabIndex = 30;
@ -2668,7 +2667,7 @@
//
this.removeHeightsButton.Image = ((System.Drawing.Image)(resources.GetObject("removeHeightsButton.Image")));
this.removeHeightsButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.removeHeightsButton.Location = new System.Drawing.Point(11, 402);
this.removeHeightsButton.Location = new System.Drawing.Point(11, 403);
this.removeHeightsButton.Name = "removeHeightsButton";
this.removeHeightsButton.Size = new System.Drawing.Size(117, 35);
this.removeHeightsButton.TabIndex = 26;
@ -2694,7 +2693,7 @@
//
this.addHeightsButton.Image = ((System.Drawing.Image)(resources.GetObject("addHeightsButton.Image")));
this.addHeightsButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.addHeightsButton.Location = new System.Drawing.Point(11, 366);
this.addHeightsButton.Location = new System.Drawing.Point(11, 367);
this.addHeightsButton.Name = "addHeightsButton";
this.addHeightsButton.Size = new System.Drawing.Size(117, 35);
this.addHeightsButton.TabIndex = 24;
@ -2771,40 +2770,40 @@
this.headersGridView.AllowUserToResizeColumns = false;
this.headersGridView.AllowUserToResizeRows = false;
this.headersGridView.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None;
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.Info;
dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.headersGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
dataGridViewCellStyle17.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle17.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
dataGridViewCellStyle17.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle17.ForeColor = System.Drawing.SystemColors.Info;
dataGridViewCellStyle17.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle17.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle17.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.headersGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle17;
this.headersGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle2.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle2.Format = "D4";
dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.headersGridView.DefaultCellStyle = dataGridViewCellStyle2;
dataGridViewCellStyle18.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle18.BackColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle18.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle18.ForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle18.Format = "D4";
dataGridViewCellStyle18.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle18.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle18.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.headersGridView.DefaultCellStyle = dataGridViewCellStyle18;
this.headersGridView.Location = new System.Drawing.Point(0, 0);
this.headersGridView.MultiSelect = false;
this.headersGridView.Name = "headersGridView";
dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle3.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F);
dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.headersGridView.RowHeadersDefaultCellStyle = dataGridViewCellStyle3;
dataGridViewCellStyle19.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle19.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle19.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F);
dataGridViewCellStyle19.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle19.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle19.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle19.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.headersGridView.RowHeadersDefaultCellStyle = dataGridViewCellStyle19;
this.headersGridView.RowHeadersWidth = 50;
this.headersGridView.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing;
dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle4.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.headersGridView.RowsDefaultCellStyle = dataGridViewCellStyle4;
dataGridViewCellStyle20.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle20.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.headersGridView.RowsDefaultCellStyle = dataGridViewCellStyle20;
this.headersGridView.RowTemplate.DefaultCellStyle.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.headersGridView.RowTemplate.Height = 18;
this.headersGridView.RowTemplate.Resizable = System.Windows.Forms.DataGridViewTriState.False;
@ -2833,43 +2832,43 @@
this.heightsGridView.AllowUserToDeleteRows = false;
this.heightsGridView.AllowUserToResizeColumns = false;
this.heightsGridView.AllowUserToResizeRows = false;
dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.heightsGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle5;
dataGridViewCellStyle21.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.heightsGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle21;
this.heightsGridView.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None;
dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle6.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle6.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F);
dataGridViewCellStyle6.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle6.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle6.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.heightsGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle6;
dataGridViewCellStyle22.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle22.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle22.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F);
dataGridViewCellStyle22.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle22.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle22.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle22.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.heightsGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle22;
this.heightsGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle7.BackColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle7.Font = new System.Drawing.Font("Tahoma", 8.25F);
dataGridViewCellStyle7.ForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle7.Format = "D2";
dataGridViewCellStyle7.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle7.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.heightsGridView.DefaultCellStyle = dataGridViewCellStyle7;
dataGridViewCellStyle23.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle23.BackColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle23.Font = new System.Drawing.Font("Tahoma", 8.25F);
dataGridViewCellStyle23.ForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle23.Format = "D2";
dataGridViewCellStyle23.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle23.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle23.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.heightsGridView.DefaultCellStyle = dataGridViewCellStyle23;
this.heightsGridView.Location = new System.Drawing.Point(0, 0);
this.heightsGridView.MultiSelect = false;
this.heightsGridView.Name = "heightsGridView";
dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle8.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle8.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F);
dataGridViewCellStyle8.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle8.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle8.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.heightsGridView.RowHeadersDefaultCellStyle = dataGridViewCellStyle8;
dataGridViewCellStyle24.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle24.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle24.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F);
dataGridViewCellStyle24.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle24.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle24.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle24.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.heightsGridView.RowHeadersDefaultCellStyle = dataGridViewCellStyle24;
this.heightsGridView.RowHeadersWidth = 50;
this.heightsGridView.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing;
dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle9.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.heightsGridView.RowsDefaultCellStyle = dataGridViewCellStyle9;
dataGridViewCellStyle25.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle25.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.heightsGridView.RowsDefaultCellStyle = dataGridViewCellStyle25;
this.heightsGridView.RowTemplate.DefaultCellStyle.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.heightsGridView.RowTemplate.Height = 18;
this.heightsGridView.RowTemplate.Resizable = System.Windows.Forms.DataGridViewTriState.False;
@ -2896,43 +2895,43 @@
this.mapFilesGridView.AllowUserToDeleteRows = false;
this.mapFilesGridView.AllowUserToResizeColumns = false;
this.mapFilesGridView.AllowUserToResizeRows = false;
dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.mapFilesGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle10;
dataGridViewCellStyle26.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.mapFilesGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle26;
this.mapFilesGridView.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None;
dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle11.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle11.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F);
dataGridViewCellStyle11.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle11.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle11.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle11.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.mapFilesGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle11;
dataGridViewCellStyle27.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle27.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle27.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F);
dataGridViewCellStyle27.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle27.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle27.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle27.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.mapFilesGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle27;
this.mapFilesGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle12.BackColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle12.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle12.ForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle12.Format = "D4";
dataGridViewCellStyle12.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle12.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle12.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.mapFilesGridView.DefaultCellStyle = dataGridViewCellStyle12;
dataGridViewCellStyle28.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle28.BackColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle28.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle28.ForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle28.Format = "D4";
dataGridViewCellStyle28.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle28.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle28.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.mapFilesGridView.DefaultCellStyle = dataGridViewCellStyle28;
this.mapFilesGridView.Location = new System.Drawing.Point(0, 0);
this.mapFilesGridView.MultiSelect = false;
this.mapFilesGridView.Name = "mapFilesGridView";
dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle13.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle13.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F);
dataGridViewCellStyle13.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle13.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle13.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle13.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.mapFilesGridView.RowHeadersDefaultCellStyle = dataGridViewCellStyle13;
dataGridViewCellStyle29.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle29.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle29.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F);
dataGridViewCellStyle29.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle29.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle29.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle29.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.mapFilesGridView.RowHeadersDefaultCellStyle = dataGridViewCellStyle29;
this.mapFilesGridView.RowHeadersWidth = 50;
this.mapFilesGridView.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing;
dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle14.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.mapFilesGridView.RowsDefaultCellStyle = dataGridViewCellStyle14;
dataGridViewCellStyle30.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle30.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.mapFilesGridView.RowsDefaultCellStyle = dataGridViewCellStyle30;
this.mapFilesGridView.RowTemplate.DefaultCellStyle.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.mapFilesGridView.RowTemplate.Height = 18;
this.mapFilesGridView.RowTemplate.Resizable = System.Windows.Forms.DataGridViewTriState.False;
@ -7397,8 +7396,8 @@
this.textEditorDataGridView.Location = new System.Drawing.Point(12, 77);
this.textEditorDataGridView.Name = "textEditorDataGridView";
this.textEditorDataGridView.RowHeadersWidth = 68;
dataGridViewCellStyle15.Font = new System.Drawing.Font("Consolas", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.textEditorDataGridView.RowsDefaultCellStyle = dataGridViewCellStyle15;
dataGridViewCellStyle31.Font = new System.Drawing.Font("Consolas", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.textEditorDataGridView.RowsDefaultCellStyle = dataGridViewCellStyle31;
this.textEditorDataGridView.Size = new System.Drawing.Size(873, 500);
this.textEditorDataGridView.TabIndex = 24;
this.textEditorDataGridView.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.textEditorDataGridView_CellValueChanged);
@ -7502,9 +7501,9 @@
this.cameraEditorDataGridView.CausesValidation = false;
this.cameraEditorDataGridView.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.Raised;
this.cameraEditorDataGridView.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
dataGridViewCellStyle16.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle16.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.cameraEditorDataGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle16;
dataGridViewCellStyle32.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle32.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.cameraEditorDataGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle32;
this.cameraEditorDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.cameraEditorDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.DistanceGVCol,
@ -10270,7 +10269,7 @@
this.nSBMDUtilityToolStripMenuItem,
this.exportScriptDatabaseJSONToolStripMenuItem});
this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem";
this.aboutToolStripMenuItem.Size = new System.Drawing.Size(46, 20);
this.aboutToolStripMenuItem.Size = new System.Drawing.Size(47, 20);
this.aboutToolStripMenuItem.Text = "Tools";
//
// romToolboxToolStripMenuItem
@ -10430,7 +10429,7 @@
this.texturizeNSBMDToolStripMenuItem.Image = global::DSPRE.Properties.Resources.addTextureToNSBMD;
this.texturizeNSBMDToolStripMenuItem.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
this.texturizeNSBMDToolStripMenuItem.Name = "texturizeNSBMDToolStripMenuItem";
this.texturizeNSBMDToolStripMenuItem.Size = new System.Drawing.Size(251, 38);
this.texturizeNSBMDToolStripMenuItem.Size = new System.Drawing.Size(250, 38);
this.texturizeNSBMDToolStripMenuItem.Text = "Add/Replace NSBMD textures";
this.texturizeNSBMDToolStripMenuItem.Click += new System.EventHandler(this.nsbmdAddTexButton_Click);
//
@ -10439,7 +10438,7 @@
this.untexturizeToolStripMenuItem.Image = global::DSPRE.Properties.Resources.removeTextureNSBMD;
this.untexturizeToolStripMenuItem.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
this.untexturizeToolStripMenuItem.Name = "untexturizeToolStripMenuItem";
this.untexturizeToolStripMenuItem.Size = new System.Drawing.Size(251, 38);
this.untexturizeToolStripMenuItem.Size = new System.Drawing.Size(250, 38);
this.untexturizeToolStripMenuItem.Text = "Remove textures from NSBMD";
this.untexturizeToolStripMenuItem.Click += new System.EventHandler(this.nsbmdRemoveTexButton_Click);
//
@ -10448,7 +10447,7 @@
this.extractNSBTXFromNSBMDToolStripMenuItem.Image = global::DSPRE.Properties.Resources.saveTextureFromNSBMD;
this.extractNSBTXFromNSBMDToolStripMenuItem.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
this.extractNSBTXFromNSBMDToolStripMenuItem.Name = "extractNSBTXFromNSBMDToolStripMenuItem";
this.extractNSBTXFromNSBMDToolStripMenuItem.Size = new System.Drawing.Size(251, 38);
this.extractNSBTXFromNSBMDToolStripMenuItem.Size = new System.Drawing.Size(250, 38);
this.extractNSBTXFromNSBMDToolStripMenuItem.Text = "Save textures from NSBMD";
this.extractNSBTXFromNSBMDToolStripMenuItem.Click += new System.EventHandler(this.nsbmdExportTexButton_Click);
//
@ -10920,13 +10919,6 @@
this.versionLabel.Text = "ROM:";
this.versionLabel.Visible = false;
//
// exportScriptDatabaseJSONToolStripMenuItem
//
this.exportScriptDatabaseJSONToolStripMenuItem.Name = "exportScriptDatabaseJSONToolStripMenuItem";
this.exportScriptDatabaseJSONToolStripMenuItem.Size = new System.Drawing.Size(220, 22);
this.exportScriptDatabaseJSONToolStripMenuItem.Text = "Export ScriptDatabase JSON";
this.exportScriptDatabaseJSONToolStripMenuItem.Click += new System.EventHandler(this.exportScriptDatabaseJSONToolStripMenuItem_Click);
//
// MainProgram
//
this.AllowDrop = true;

View File

@ -1028,19 +1028,6 @@ namespace DSPRE {
return;
}
// Creating a dictionary linking events to headers to fetch header data for Event Editor
if (PatchToolboxDialog.flag_DynamicHeadersPatchApplied || PatchToolboxDialog.CheckFilesDynamicHeadersPatchApplied()) {
for (ushort i = 0; i < internalNames.Count; i++) {
MapHeader h = MapHeader.LoadFromFile(RomInfo.gameDirs[DirNames.dynamicHeaders].unpackedDir + "\\" + i.ToString("D4"), i, 0);
eventToHeader[h.eventFileID] = i;
}
} else {
for (ushort i = 0; i < internalNames.Count; i++) {
MapHeader h = MapHeader.LoadFromARM9(i);
eventToHeader[h.eventFileID] = i;
}
}
/*Add list of options to each control */
currentTextArchive = new TextArchive(RomInfo.locationNamesTextNumber);
@ -5507,12 +5494,12 @@ namespace DSPRE {
} else {
ScriptFile itemScript = new ScriptFile(RomInfo.itemScriptFileNumber);
owItemComboBox.Items.Clear();
foreach (ScriptCommandContainer cont in itemScript.allScripts) {
if (cont.commands.Count > 4) {
continue;
}
owItemComboBox.Items.Add(BitConverter.ToUInt16(cont.commands[1].cmdParams[1], 0) + "x " + itemNames[BitConverter.ToUInt16(cont.commands[0].cmdParams[1], 0)]);
}
//foreach (ScriptCommandContainer cont in itemScript.allScripts) {
// if (cont.commands.Count > 4) {
// continue;
// }
// owItemComboBox.Items.Add(BitConverter.ToUInt16(cont.commands[1].Parameters[1].RawData, 0) + "x " + itemNames[BitConverter.ToUInt16(cont.commands[0].Parameters[1].RawData, 0)]);
//}
}
/* Add ow movement list to box */
@ -5542,6 +5529,19 @@ namespace DSPRE {
eventMatrixUpDown.Maximum = romInfo.GetMatrixCount() - 1;
eventAreaDataUpDown.Maximum = romInfo.GetAreaDataCount() - 1;
// Creating a dictionary linking events to headers to fetch header data for Event Editor
if (PatchToolboxDialog.flag_DynamicHeadersPatchApplied || PatchToolboxDialog.CheckFilesDynamicHeadersPatchApplied()) {
for (ushort i = 0; i < internalNames.Count; i++) {
MapHeader h = MapHeader.LoadFromFile(RomInfo.gameDirs[DirNames.dynamicHeaders].unpackedDir + "\\" + i.ToString("D4"), i, 0);
eventToHeader[h.eventFileID] = i;
}
} else {
for (ushort i = 0; i < internalNames.Count; i++) {
MapHeader h = MapHeader.LoadFromARM9(i);
eventToHeader[h.eventFileID] = i;
}
}
Helpers.EnableHandlers();
selectEventComboBox.SelectedIndex = 0;
@ -5752,10 +5752,15 @@ namespace DSPRE {
if (Helpers.HandlersDisabled) {
return;
}
Helpers.DisableHandlers();
ChangeLoadedEventFile(selectEventComboBox.SelectedIndex, 0);
}
private void ChangeLoadedEventFile(int evfile, ushort mapHeader) {
Helpers.DisableHandlers();
/* Load events data into EventFile class instance */
currentEvFile = new EventFile(selectEventComboBox.SelectedIndex);
currentEvFile = new EventFile(evfile);
/* Update ListBoxes */
FillSpawnablesBox();
@ -5763,7 +5768,7 @@ namespace DSPRE {
FillTriggersBox();
FillWarpsBox();
if (eventToHeader.TryGetValue((ushort)selectEventComboBox.SelectedIndex, out ushort mapHeader)) {
if (mapHeader > 0 || eventToHeader.TryGetValue((ushort)selectEventComboBox.SelectedIndex, out mapHeader)) {
MapHeader h;
if (PatchToolboxDialog.flag_DynamicHeadersPatchApplied || PatchToolboxDialog.CheckFilesDynamicHeadersPatchApplied()) {
h = MapHeader.LoadFromFile(RomInfo.gameDirs[DirNames.dynamicHeaders].unpackedDir + "\\" + mapHeader.ToString("D4"), mapHeader, 0);
@ -5788,6 +5793,7 @@ namespace DSPRE {
CenterEventViewOnEntities();
}
private void showEventsCheckBoxes_CheckedChanged(object sender, EventArgs e) {
if (Helpers.HandlersDisabled) {
return;
@ -6655,20 +6661,26 @@ namespace DSPRE {
if (new EventFile(destHeader.eventFileID).warps.Count < destAnchor + 1) {
DialogResult d = MessageBox.Show("The selected warp's destination anchor doesn't exist.\n" +
"Do you want to open the destination map anyway?", "Warp is not connected", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (d == DialogResult.No)
return;
else {
if (d == DialogResult.Yes) {
eventMatrixUpDown.Value = destHeader.matrixID;
eventAreaDataUpDown.Value = destHeader.areaDataID;
Helpers.DisableHandlers();
selectEventComboBox.SelectedIndex = destHeader.eventFileID;
ChangeLoadedEventFile(destHeader.eventFileID, destHeaderID);
CenterEventViewOnEntities();
return;
}
return;
}
eventMatrixUpDown.Value = destHeader.matrixID;
eventAreaDataUpDown.Value = destHeader.areaDataID;
Helpers.DisableHandlers();
selectEventComboBox.SelectedIndex = destHeader.eventFileID;
ChangeLoadedEventFile(destHeader.eventFileID, destHeaderID);
warpsListBox.SelectedIndex = destAnchor;
centerEventViewOnSelectedEvent_Click(sender, e);
@ -9945,17 +9957,17 @@ namespace DSPRE {
string[] abilityNames = RomInfo.GetAbilityNames();
string[] moveNames = RomInfo.GetAttackNames();
Helpers.statusLabelMessage("Setting up Pokemon Data Editor...");
Helpers.statusLabelMessage("Setting up Pokémon Data Editor...");
Update();
DSUtils.TryUnpackNarcs(new List<DirNames> { DirNames.personalPokeData, DirNames.learnsets, DirNames.evolutions, DirNames.monIcons });
RomInfo.SetMonIconsPalTableAddress();
PokemonEditor pde = new PokemonEditor(itemNames, abilityNames, moveNames);
pde.ShowDialog();
Helpers.statusLabelMessage();
Update();
pde.ShowDialog();
}
private void overlayEditorToolStripMenuItem_Click(object sender, EventArgs e) {

File diff suppressed because it is too large Load Diff

View File

@ -258,18 +258,18 @@ namespace DSPRE
public static bool CheckScriptsStandardizedItemNumbers()
{
ScriptFile itemScript = new ScriptFile(RomInfo.itemScriptFileNumber);
if (itemScript.allScripts.Count - 1 < new TextArchive(RomInfo.itemNamesTextNumber).messages.Count)
{
return false;
}
//if (itemScript.allScripts.Count - 1 < new TextArchive(RomInfo.itemNamesTextNumber).messages.Count)
//{
// return false;
//}
for (ushort i = 0; i < itemScript.allScripts.Count - 1; i++)
{
if (BitConverter.ToUInt16(itemScript.allScripts[i].commands[0].cmdParams[1], 0) != i || BitConverter.ToUInt16(itemScript.allScripts[i].commands[1].cmdParams[1], 0) != 1)
{
return false;
}
}
//for (ushort i = 0; i < itemScript.allScripts.Count - 1; i++)
//{
// if (BitConverter.ToUInt16(itemScript.allScripts[i].commands[0].Parameters[1].RawData, 0) != i || BitConverter.ToUInt16(itemScript.allScripts[i].commands[1].Parameters[1].RawData, 0) != 1)
// {
// return false;
// }
//}
return true;
}
@ -590,12 +590,12 @@ namespace DSPRE
ScriptFile itemScriptFile = new ScriptFile(RomInfo.itemScriptFileNumber);
// Create map for: script no. -> vanilla item
int[] vanillaItemsArray = new int[itemScriptFile.allScripts.Count - 1];
for (int i = 0; i < itemScriptFile.allScripts.Count - 1; i++)
{
vanillaItemsArray[i] = BitConverter.ToInt16(itemScriptFile.allScripts[i].commands[0].cmdParams[1], 0);
};
//int[] vanillaItemsArray = new int[itemScriptFile.allScripts.Count - 1];
//
//for (int i = 0; i < itemScriptFile.allScripts.Count - 1; i++)
//{
// vanillaItemsArray[i] = BitConverter.ToInt16(itemScriptFile.allScripts[i].commands[0].Parameters[1].RawData, 0);
//};
// Parse all event files and fix instances of ground items according to the new order
int cnt = Filesystem.GetEventFileCount();
@ -617,7 +617,7 @@ namespace DSPRE
if (isItem)
{
int itemScriptID = eventFile.overworlds[j].scriptNumber - (itemScrMin - 1);
eventFile.overworlds[j].scriptNumber = (ushort)(itemScrMin + vanillaItemsArray[itemScriptID - 1]);
//eventFile.overworlds[j].scriptNumber = (ushort)(itemScrMin + vanillaItemsArray[itemScriptID - 1]);
dirty = true;
}
}
@ -644,29 +644,29 @@ namespace DSPRE
using (DSUtils.EasyWriter ewr = new DSUtils.EasyWriter(ow9path, ow9offs))
{
ewr.Write((ushort)(itemScrMin + vanillaItemsArray[itemScriptID - 1]));
//ewr.Write((ushort)(itemScrMin + vanillaItemsArray[itemScriptID - 1]));
}
}
// Sort scripts in the Script File according to item indices
int itemCount = new TextArchive(RomInfo.itemNamesTextNumber).messages.Count;
ScriptCommandContainer executeGive = new ScriptCommandContainer((uint)itemCount + 1, itemScriptFile.allScripts[itemScriptFile.allScripts.Count - 1]);
//ScriptCommandContainer executeGive = new ScriptCommandContainer((uint)itemCount + 1, itemScriptFile.allScripts[itemScriptFile.allScripts.Count - 1]);
itemScriptFile.allScripts.Clear();
//itemScriptFile.allScripts.Clear();
for (ushort i = 0; i < itemCount; i++)
{
List<ScriptCommand> cmdList = new List<ScriptCommand> {
new ScriptCommand("SetVar 0x8008 " + i),
new ScriptCommand("SetVar 0x8009 0x1"),
new ScriptCommand("Jump Function_#1")
};
itemScriptFile.allScripts.Add(new ScriptCommandContainer((ushort)(i + 1), ScriptFile.ContainerTypes.Script, commandList: cmdList));
}
itemScriptFile.allScripts.Add(executeGive);
itemScriptFile.allFunctions[0].usedScriptID = itemCount + 1;
//for (ushort i = 0; i < itemCount; i++)
//{
// List<ScriptCommand> cmdList = new List<ScriptCommand> {
// new ScriptCommand("SetVar 0x8008 " + i),
// new ScriptCommand("SetVar 0x8009 0x1"),
// new ScriptCommand("Jump Function_#1")
// };
//
// itemScriptFile.allScripts.Add(new ScriptCommandContainer((ushort)(i + 1), ScriptFile.ContainerTypes.Script, commandList: cmdList));
//}
//
//itemScriptFile.allScripts.Add(executeGive);
//itemScriptFile.allFunctions[0].usedScriptID = itemCount + 1;
itemScriptFile.SaveToFileDefaultDir(RomInfo.itemScriptFileNumber, showSuccessMessage: false);
MessageBox.Show("Operation successful.", "Process completed.", MessageBoxButtons.OK, MessageBoxIcon.Information);

View File

@ -8,6 +8,7 @@ namespace DSPRE {
internal class LearnsetData : RomFile {
public static readonly int bitsMove = 9;
public static readonly int bitsLevel = 7;
public static readonly int VanillaLimit = 20;
public readonly UniqueList<(byte level, ushort move)> list;

View File

@ -1,13 +0,0 @@
using System.Collections.Generic;
namespace DSPRE.ROMFiles {
public class ScriptActionContainer {
public List<ScriptAction> commands;
public uint manualUserID;
public ScriptActionContainer(uint actionNumber, List<ScriptAction> commands = null) {
manualUserID = actionNumber;
this.commands = commands;
}
}
}

View File

@ -1,25 +0,0 @@
using System.Collections.Generic;
namespace DSPRE.ROMFiles {
public class ScriptCommandContainer {
public List<ScriptCommand> commands;
public uint manualUserID;
public int usedScriptID; //useScript ID referenced by this Script/Function
public ScriptFile.ContainerTypes containerType;
internal static readonly string functionStart;
public ScriptCommandContainer(uint scriptNumber, ScriptFile.ContainerTypes containerType, int usedScriptID = -1, List<ScriptCommand> commandList = null) {
manualUserID = scriptNumber;
this.usedScriptID = usedScriptID;
this.containerType = containerType;
commands = commandList;
}
public ScriptCommandContainer(uint newID, ScriptCommandContainer toCopy) {
manualUserID = newID;
usedScriptID = toCopy.usedScriptID;
containerType = toCopy.containerType;
commands = new List<ScriptCommand>(toCopy.commands); //command parameters need to be copied recursively
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -505,7 +505,7 @@ namespace DSPRE.Resources {
[0x0182] = "SetBerryMulch",
[0x0183] = "SetBerrySpecies",
[0x0184] = "WateringAnimation",
[0x0185] = "TakeBerries",
[0x0185] = "HarvestBerries",
[0x0186] = "SetOWDefaultPosition",
[0x0187] = "SetOWPosition",
[0x0188] = "SetOWDefaultMovement",
@ -636,6 +636,7 @@ namespace DSPRE.Resources {
[0x0246] = "CheckVersion",
[0x0247] = "FirstPokemonInParty",
[0x0248] = "GetPartyPokemonTypes",
[0x024E] = "GetLottoNumber",
[0x024F] = "CheckWinLotto",
@ -1681,11 +1682,11 @@ namespace DSPRE.Resources {
[0x0336] = new byte[] { 2 },
//International release exclusive
[0x0337] = new byte[1] { 0 },
[0x0337] = new byte[] { 2, 2 },
[0x0338] = new byte[1] { 0 },
[0x0339] = new byte[1] { 0 },
[0x033A] = new byte[] { 1 },
[0x033B] = new byte[1] { 0 },
[0x033B] = new byte[] { 1 },
[0x033C] = new byte[] { 1, 2 },
[0x033D] = new byte[] { 1, 2 },
[0x033E] = new byte[] { 1, 2 },
@ -2068,6 +2069,7 @@ namespace DSPRE.Resources {
[0x01EF] = "CheckVersion",
[0x01F0] = "FirstPokemonInParty",
[0x01F1] = "GetPartyPokemonTypes",
[0x01F7] = "GetLottoNumber",
[0x01F8] = "CheckWinLotto",
@ -2129,6 +2131,10 @@ namespace DSPRE.Resources {
[0x026A] = "CheckAlbumPhoto",
[0x026E] = "GetOWDirection",
[0x026F] = "HarvestApricorn",
[0x0270] = "GetApricornColor",
[0x0271] = "GiveApricorn",
[0x0272] = "TextApricorn",
[0x0289] = "ScratchOffScreen",
[0x028A] = "ReleaseScriptApp",

View File

@ -905,6 +905,7 @@ namespace DSPRE
{
case GameLanguages.English:
case GameLanguages.Italian:
case GameLanguages.French:
monIconPalTableAddress = BitConverter.ToUInt32(ARM9.ReadBytes(0x74408, 4), 0);
break;
@ -919,7 +920,6 @@ namespace DSPRE
}
break;
case GameLanguages.French:
case GameLanguages.Spanish:
if (gameVersion == GameVersions.HeartGold)
{

View File

@ -3,6 +3,7 @@ using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace DSPRE.ROMFiles {
@ -16,15 +17,17 @@ namespace DSPRE.ROMFiles {
OW_DIRECTION,
FUNCTION_ID,
ACTION_ID,
CMD_NUMBER
CMD_NUMBER,
LABEL_REF
};
public ushort? id;
public List<byte[]> cmdParams;
public List<ScriptParameter> Parameters { get; set; } = new List<ScriptParameter>();
public string name;
public ScriptCommand(ushort id, List<byte[]> parametersList) {
if (parametersList is null) {
// CHANGE: Update the constructor to use ScriptParameter
public ScriptCommand(ushort id, List<ScriptParameter> parameters) {
if (parameters is null) {
this.id = null;
return;
}
@ -36,47 +39,48 @@ namespace DSPRE.ROMFiles {
switch (id) {
case 0x0016: // Jump
case 0x001A: // Call
name += $" {FormatNumber(parametersList[0], ParamTypeEnum.FUNCTION_ID)}";
name += $" {FormatParameter(parameters[0], ParamTypeEnum.FUNCTION_ID)}";
break;
case 0x0017: // JumpIfObjID
case 0x0018: // JumpIfEventID
name += $" {FormatNumber(parametersList[0], ParamTypeEnum.OW_ID)} {FormatNumber(parametersList[1])}";
name += $" {FormatParameter(parameters[0], ParamTypeEnum.OW_ID)} {FormatParameter(parameters[1])}";
break;
case 0x0019: // JumpIfPlayerDir
name += $" {FormatNumber(parametersList[0], ParamTypeEnum.OW_DIRECTION)} {FormatNumber(parametersList[1], ParamTypeEnum.FUNCTION_ID)}";
name += $" {FormatParameter(parameters[0], ParamTypeEnum.OW_DIRECTION)} {FormatParameter(parameters[1], ParamTypeEnum.FUNCTION_ID)}";
break;
case 0x001C: // JumpIf
case 0x001D: // CallIf
{
string number = FormatNumber(parametersList[1], ParamTypeEnum.FUNCTION_ID);
string number = FormatParameter(parameters[1], ParamTypeEnum.FUNCTION_ID);
if (RomInfo.ScriptComparisonOperatorsDict.TryGetValue(parametersList[0][0], out string v)) {
// Access the byte value from the parameter's raw data
if (RomInfo.ScriptComparisonOperatorsDict.TryGetValue(parameters[0].RawData[0], out string v)) {
name += $" {v} {number}";
} else {
name += $" {parametersList[0][0]} {number}";
name += $" {parameters[0].RawData[0]} {number}";
}
break;
}
case 0x005E: // Movement
name += $" {FormatNumber(parametersList[0], ParamTypeEnum.OW_ID)} {FormatNumber(parametersList[1], ParamTypeEnum.ACTION_ID)}";
name += $" {FormatParameter(parameters[0], ParamTypeEnum.OW_ID)} {FormatParameter(parameters[1], ParamTypeEnum.ACTION_ID)}";
break;
case 0x006A: // GetOverworldPosition
name += FormatCmd_Overworld_TwoParams(parametersList);
name += FormatCmd_Overworld_TwoParams(parameters);
break;
case 0x0062: // Lock
case 0x0063: // Release
case 0x0064: // AddOW
case 0x0065: // RemoveOW
name += $" {FormatNumber(parametersList[0], ParamTypeEnum.OW_ID)}";
name += $" {FormatParameter(parameters[0], ParamTypeEnum.OW_ID)}";
break;
case 0x006D: // SetOverworldMovement
name += FormatCmd_Overworld_Move(parametersList);
name += FormatCmd_Overworld_Move(parameters);
break;
case 0x00B0: // Warp [HGSS]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.HGSS)) {
name += FormatCmd_Warp(parametersList);
name += FormatCmd_Warp(parameters);
} else {
goto default;
}
@ -84,7 +88,7 @@ namespace DSPRE.ROMFiles {
break;
case 0x0152: // SetOverworldDefaultPosition [HGSS]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.HGSS)) {
name += FormatCmd_Overworld_TwoParams(parametersList);
name += FormatCmd_Overworld_TwoParams(parameters);
} else {
goto default;
}
@ -92,7 +96,7 @@ namespace DSPRE.ROMFiles {
break;
case 0x0153: // SetOverworldPosition [HGSS]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.HGSS)) {
name += FormatCmd_Overworld_3Coords_Dir(parametersList);
name += FormatCmd_Overworld_3Coords_Dir(parameters);
} else {
goto default;
}
@ -100,7 +104,7 @@ namespace DSPRE.ROMFiles {
break;
case 0x0154: // SetOverworldDefaultMovement [HGSS]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.HGSS)) {
name += FormatCmd_Overworld_Move(parametersList);
name += FormatCmd_Overworld_Move(parameters);
} else {
goto default;
}
@ -108,7 +112,7 @@ namespace DSPRE.ROMFiles {
break;
case 0x0155: // SetOverworldDefaultDirection [DPPt]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.HGSS)) {
name += FormatCmd_Overworld_Dir(parametersList);
name += FormatCmd_Overworld_Dir(parameters);
} else {
goto default;
}
@ -116,7 +120,7 @@ namespace DSPRE.ROMFiles {
break;
case 0x0158: // SetOverworldDirection [DPPt]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.HGSS)) {
name += FormatCmd_Overworld_Dir(parametersList);
name += FormatCmd_Overworld_Dir(parameters);
} else {
goto default;
}
@ -125,7 +129,7 @@ namespace DSPRE.ROMFiles {
case 0x00BE: // Warp [DPPt]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.DP) || RomInfo.gameFamily.Equals(RomInfo.GameFamilies.Plat)) {
name += FormatCmd_Warp(parametersList);
name += FormatCmd_Warp(parameters);
} else {
goto default;
}
@ -133,7 +137,7 @@ namespace DSPRE.ROMFiles {
break;
case 0x0186: // SetOverworldDefaultPosition [DPPt]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.DP) || RomInfo.gameFamily.Equals(RomInfo.GameFamilies.Plat)) {
name += FormatCmd_Overworld_TwoParams(parametersList);
name += FormatCmd_Overworld_TwoParams(parameters);
} else {
goto default;
}
@ -141,7 +145,7 @@ namespace DSPRE.ROMFiles {
break;
case 0x0187: // SetOverworldPosition [DPPt]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.DP) || RomInfo.gameFamily.Equals(RomInfo.GameFamilies.Plat)) {
name += FormatCmd_Overworld_3Coords_Dir(parametersList);
name += FormatCmd_Overworld_3Coords_Dir(parameters);
} else {
goto default;
}
@ -149,7 +153,7 @@ namespace DSPRE.ROMFiles {
break;
case 0x0188: // SetOverworldDefaultMovement [DPPt]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.DP) || RomInfo.gameFamily.Equals(RomInfo.GameFamilies.Plat)) {
name += FormatCmd_Overworld_Move(parametersList);
name += FormatCmd_Overworld_Move(parameters);
} else {
goto default;
}
@ -157,7 +161,7 @@ namespace DSPRE.ROMFiles {
break;
case 0x0189: // SetOverworldDefaultDirection [DPPt]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.DP) || RomInfo.gameFamily.Equals(RomInfo.GameFamilies.Plat)) {
name += FormatCmd_Overworld_Dir(parametersList);
name += FormatCmd_Overworld_Dir(parameters);
} else {
goto default;
}
@ -165,47 +169,47 @@ namespace DSPRE.ROMFiles {
break;
case 0x018C: // SetOverworldDirection [DPPt]
if (RomInfo.gameFamily.Equals(RomInfo.GameFamilies.DP) || RomInfo.gameFamily.Equals(RomInfo.GameFamilies.Plat)) {
name += FormatCmd_Overworld_Dir(parametersList);
name += FormatCmd_Overworld_Dir(parameters);
} else {
goto default;
}
break;
default:
for (int i = 0; i < parametersList.Count; i++) {
name += $" {FormatNumber(parametersList[i])}";
for (int i = 0; i < parameters.Count; i++) {
name += $" {FormatParameter(parameters[i])}";
}
break;
}
this.id = id;
this.cmdParams = parametersList;
this.Parameters = parameters;
}
private string FormatCmd_Warp(List<byte[]> parametersList) {
return $" {FormatNumber(parametersList[0])} {FormatNumber(parametersList[1])} {FormatNumber(parametersList[2])} {FormatNumber(parametersList[3])} {FormatNumber(parametersList[4], ParamTypeEnum.OW_DIRECTION)}";
private string FormatCmd_Warp(List<ScriptParameter> parameters) {
return $" {FormatParameter(parameters[0])} {FormatParameter(parameters[1])} {FormatParameter(parameters[2])} {FormatParameter(parameters[3])} {FormatParameter(parameters[4], ParamTypeEnum.OW_DIRECTION)}";
}
private string FormatCmd_Overworld_TwoParams(List<byte[]> parametersList) {
return $" {FormatNumber(parametersList[0], ParamTypeEnum.OW_ID)} {FormatNumber(parametersList[1])} {FormatNumber(parametersList[2])}";
private string FormatCmd_Overworld_TwoParams(List<ScriptParameter> parameters) {
return $" {FormatParameter(parameters[0], ParamTypeEnum.OW_ID)} {FormatParameter(parameters[1])} {FormatParameter(parameters[2])}";
}
private string FormatCmd_Overworld_Move(List<byte[]> parametersList) {
return $" {FormatNumber(parametersList[0], ParamTypeEnum.OW_ID)} {FormatNumber(parametersList[1], ParamTypeEnum.OW_MOVEMENT_TYPE)}";
private string FormatCmd_Overworld_Move(List<ScriptParameter> parameters) {
return $" {FormatParameter(parameters[0], ParamTypeEnum.OW_ID)} {FormatParameter(parameters[1], ParamTypeEnum.OW_MOVEMENT_TYPE)}";
}
private string FormatCmd_Overworld_3Coords_Dir(List<byte[]> parametersList) {
return $" {FormatNumber(parametersList[0], ParamTypeEnum.OW_ID)} {FormatNumber(parametersList[1])} {FormatNumber(parametersList[2])} {FormatNumber(parametersList[3])} {FormatNumber(parametersList[4], ParamTypeEnum.OW_DIRECTION)}";
private string FormatCmd_Overworld_3Coords_Dir(List<ScriptParameter> parameters) {
return $" {FormatParameter(parameters[0], ParamTypeEnum.OW_ID)} {FormatParameter(parameters[1])} {FormatParameter(parameters[2])} {FormatParameter(parameters[3])} {FormatParameter(parameters[4], ParamTypeEnum.OW_DIRECTION)}";
}
private string FormatCmd_Overworld_Dir(List<byte[]> parametersList) {
return $" {FormatNumber(parametersList[0], ParamTypeEnum.OW_ID)} {FormatNumber(parametersList[1], ParamTypeEnum.OW_DIRECTION)}";
private string FormatCmd_Overworld_Dir(List<ScriptParameter> parameters) {
return $" {FormatParameter(parameters[0], ParamTypeEnum.OW_ID)} {FormatParameter(parameters[1], ParamTypeEnum.OW_DIRECTION)}";
}
public ScriptCommand(string wholeLine, int lineNumber = 0) {
name = wholeLine;
cmdParams = new List<byte[]>();
Parameters = new List<ScriptParameter>();
string[] nameParts = wholeLine.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); // Separate command code from parameters
/* Get command id, which is always first in the description */
@ -229,9 +233,8 @@ namespace DSPRE.ROMFiles {
return;
}
}
/* Read parameters from remainder of the description */
//Console.WriteLine("ID = " + ((ushort)id).ToString("X4"));
/* Read parameters from remainder of the description */
byte[] parametersSizeArr = RomInfo.ScriptCommandParametersDict[(ushort)id];
int paramLength = 0;
@ -241,7 +244,7 @@ namespace DSPRE.ROMFiles {
int firstParamValue = int.Parse(nameParts[1].PurgeSpecial(ScriptFile.specialChars), nameParts[1].GetNumberStyle());
byte firstParamSize = parametersSizeArr[1];
cmdParams.Add(firstParamValue.ToByteArrayChooseSize(firstParamSize));
Parameters.Add(new ScriptParameter(firstParamValue.ToByteArrayChooseSize(firstParamSize)));
paramsProcessed++;
int i = 2;
@ -303,7 +306,8 @@ namespace DSPRE.ROMFiles {
Console.WriteLine($"Parameter #{i}: {nameParts[i + 1]}");
if (RomInfo.ScriptComparisonOperatorsReverseDict.TryGetValue(nameParts[i + 1].ToLower(), out cmdID)) { //Check succeeds when command is like "asdfg LESS" or "asdfg DIFFERENT"
cmdParams.Add(new byte[] { (byte)cmdID });
// Create parameter with byte array
Parameters.Add(new ScriptParameter(new byte[] { (byte)cmdID }));
} else { //Not a comparison
/* Convert strings of parameters to the correct datatypes */
NumberStyles numStyle = nameParts[i + 1].GetNumberStyle();
@ -312,6 +316,16 @@ namespace DSPRE.ROMFiles {
int result = 0;
try {
// Check if this is a label reference
if (nameParts[i + 1].StartsWith("label") || nameParts[i + 1].StartsWith("script")) {
// This is a label reference
ScriptParameter labelParam = new ScriptParameter(0, nameParts[i + 1]) {
Type = ScriptParameter.ParameterType.RelativeJump
};
Parameters.Add(labelParam);
continue;
}
result = int.Parse(nameParts[i + 1], numStyle);
} catch {
if (string.IsNullOrWhiteSpace(nameParts[i + 1])) {
@ -338,7 +352,8 @@ namespace DSPRE.ROMFiles {
}
try {
cmdParams.Add(result.ToByteArrayChooseSize(parametersSizeArr[i]));
byte[] paramData = result.ToByteArrayChooseSize(parametersSizeArr[i]);
Parameters.Add(new ScriptParameter(paramData));
} catch (OverflowException) {
MessageBox.Show($"Argument {nameParts[i + 1]} at line {lineNumber} is not in the range [0, {Math.Pow(2, 8 * parametersSizeArr[i]) - 1}].", "Argument error", MessageBoxButtons.OK, MessageBoxIcon.Error);
id = null;
@ -354,6 +369,10 @@ namespace DSPRE.ROMFiles {
}
private string FormatNumber(byte[] par, ParamTypeEnum paramType = ParamTypeEnum.INTEGER) {
if (paramType == ParamTypeEnum.LABEL_REF && par.Length > 0) {
return FormatLabelReference(Encoding.ASCII.GetString(par));
}
//number acquisition
uint num;
if (par.Length == 0) {
@ -390,9 +409,6 @@ namespace DSPRE.ROMFiles {
case ParamTypeEnum.CMD_NUMBER:
return "CMD_" + prefix + num.ToString(formatOverride + '3');
case ParamTypeEnum.FUNCTION_ID:
return ScriptFile.ContainerTypes.Function.ToString() + "#" + num;
case ParamTypeEnum.ACTION_ID:
return ScriptFile.ContainerTypes.Action.ToString() + "#" + num;
@ -440,8 +456,21 @@ namespace DSPRE.ROMFiles {
return outp;
}
private string FormatParameter(ScriptParameter param, ParamTypeEnum paramType = ParamTypeEnum.INTEGER) {
// For jump-to-label parameters, return the label name
if (param.Type == ScriptParameter.ParameterType.RelativeJump && !string.IsNullOrEmpty(param.TargetLabel)) {
return param.TargetLabel;
}
// Otherwise handle the numeric value
return FormatNumber(param.RawData, paramType);
}
public override string ToString() {
return name + " (" + ((ushort)id).ToString("X") + ")";
}
private string FormatLabelReference(string labelName) {
return labelName;
}
}
}

View File

@ -0,0 +1,20 @@
// ScriptCommandPosition.cs
using System;
namespace DSPRE.ROMFiles {
public class ScriptCommandPosition {
public ScriptCommand Command { get; set; }
public int Offset { get; set; }
public string Label { get; set; } // null if no label needed
public bool IsEntryPoint { get; set; }
public int EntryPointIndex { get; set; } // -1 if not an entry point
public ScriptCommandPosition(ScriptCommand cmd, int offset, string label = null, bool isEntryPoint = false, int entryPointIndex = -1) {
Command = cmd;
Offset = offset;
Label = label;
IsEntryPoint = isEntryPoint;
EntryPointIndex = entryPointIndex;
}
}
}

View File

@ -0,0 +1,21 @@
// Create this as a new file: ScriptLabeledSection.cs
using System;
using System.Collections.Generic;
namespace DSPRE.ROMFiles {
public class ScriptLabeledSection {
public string LabelName { get; set; }
public List<ScriptCommand> Commands { get; set; }
public uint OffsetInFile { get; set; }
public bool IsReferenced { get; set; } = false;
public ScriptLabeledSection(string labelName, List<ScriptCommand> commands = null) {
LabelName = labelName;
Commands = commands ?? new List<ScriptCommand>();
}
public override string ToString() {
return LabelName;
}
}
}

View File

@ -0,0 +1,45 @@
using System;
public class ScriptParameter {
public enum ParameterType {
Integer,
RelativeJump,
Byte,
Variable
}
public ParameterType Type { get; set; } = ParameterType.Integer;
public byte[] RawData { get; set; }
public string TargetLabel { get; set; } // For RelativeJump type
public int TargetOffset { get; set; } // For RelativeJump type
// Constructor for regular parameters
public ScriptParameter(byte[] data) {
Type = ParameterType.Integer;
RawData = data;
}
// Constructor for relative jumps
public ScriptParameter(int targetOffset, string targetLabel) {
Type = ParameterType.RelativeJump;
TargetOffset = targetOffset;
TargetLabel = targetLabel;
// Store raw bytes only for display purposes
RawData = BitConverter.GetBytes(targetOffset);
}
// Get display representation
public string GetFormattedValue() {
if (Type == ParameterType.RelativeJump && !string.IsNullOrEmpty(TargetLabel)) {
return TargetLabel;
}
// Default formatting for other types
if (RawData.Length == 0) return "";
if (RawData.Length == 1) return RawData[0].ToString("X2");
if (RawData.Length == 2) return BitConverter.ToUInt16(RawData, 0).ToString("X4");
if (RawData.Length == 4) return BitConverter.ToUInt32(RawData, 0).ToString("X8");
return BitConverter.ToString(RawData);
}
}

View File

@ -147,4 +147,4 @@ Edit base stats, Learnable TMs, EVs yield, and more.
Edit the moves that a given Pokemon can learn by leveling up.
### New Evolutions Editor:
Edit evolution methods and levels for all Pokemon.
Edit evolution methods and levels for all Pokemon.