mirror of
https://github.com/haven1433/HexManiacAdvance.git
synced 2026-04-26 08:18:18 -05:00
bugfixes from discord
This commit is contained in:
parent
b96761cf17
commit
7cd9da7fc0
|
|
@ -1,4 +1,5 @@
|
||||||
using System.Collections.Generic;
|
using HavenSoft.HexManiac.Core.ViewModels.DataFormats;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace HavenSoft.HexManiac.Core.Models.Runs.Factory {
|
namespace HavenSoft.HexManiac.Core.Models.Runs.Factory {
|
||||||
public class OverworldSpriteListContentStrategy : RunStrategy {
|
public class OverworldSpriteListContentStrategy : RunStrategy {
|
||||||
|
|
@ -40,6 +41,7 @@ namespace HavenSoft.HexManiac.Core.Models.Runs.Factory {
|
||||||
|
|
||||||
public override int LengthForNewRun(IDataModel model, int pointerAddress) {
|
public override int LengthForNewRun(IDataModel model, int pointerAddress) {
|
||||||
var destination = model.ReadPointer(pointerAddress);
|
var destination = model.ReadPointer(pointerAddress);
|
||||||
|
if (destination == Pointer.NULL) return 8;
|
||||||
if (destination < 0 || destination >= model.Count) return -1;
|
if (destination < 0 || destination >= model.Count) return -1;
|
||||||
return new OverworldSpriteListRun(model, parentTemplate, Hint, 0, destination, new SortedSpan<int>(pointerAddress)).Length;
|
return new OverworldSpriteListRun(model, parentTemplate, Hint, 0, destination, new SortedSpan<int>(pointerAddress)).Length;
|
||||||
}
|
}
|
||||||
|
|
@ -75,7 +77,10 @@ namespace HavenSoft.HexManiac.Core.Models.Runs.Factory {
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IFormattedRun WriteNewRun(IDataModel owner, ModelDelta token, int source, int destination, string name, IReadOnlyList<ArrayRunElementSegment> sourceSegments) {
|
public override IFormattedRun WriteNewRun(IDataModel owner, ModelDelta token, int source, int destination, string name, IReadOnlyList<ArrayRunElementSegment> sourceSegments) {
|
||||||
return new OverworldSpriteListRun(owner, sourceSegments, Hint, 0, destination, new SortedSpan<int>(source));
|
var run = new OverworldSpriteListRun(owner, sourceSegments, Hint, 0, destination, new SortedSpan<int>(source));
|
||||||
|
owner.WritePointer(token, destination, Pointer.NULL);
|
||||||
|
owner.WriteMultiByteValue(destination + 4, 4, token, 0x100);
|
||||||
|
return run;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ namespace HavenSoft.HexManiac.Core.ViewModels.Tools {
|
||||||
using (ModelCacheScope.CreateScope(model)) {
|
using (ModelCacheScope.CreateScope(model)) {
|
||||||
if (SelectedTool == TableTool) TableTool.DataForCurrentRunChanged();
|
if (SelectedTool == TableTool) TableTool.DataForCurrentRunChanged();
|
||||||
if (SelectedTool == SpriteTool) SpriteTool.DataForCurrentRunChanged();
|
if (SelectedTool == SpriteTool) SpriteTool.DataForCurrentRunChanged();
|
||||||
|
if (SelectedTool == StringTool) StringTool.DataForCurrentRunChanged();
|
||||||
CodeTool.IsSelected = SelectedTool == CodeTool;
|
CodeTool.IsSelected = SelectedTool == CodeTool;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,10 @@
|
||||||
<PostBuildEvent>
|
<PostBuildEvent>
|
||||||
mkdir "$(TargetDir)resources"
|
mkdir "$(TargetDir)resources"
|
||||||
mkdir "$(TargetDir)resources\Scripts"
|
mkdir "$(TargetDir)resources\Scripts"
|
||||||
|
mkdir "$(TargetDir)resources\Scripts\Add Mechanics From Later Generations"
|
||||||
|
mkdir "$(TargetDir)resources\Scripts\internal"
|
||||||
|
mkdir "$(TargetDir)resources\Scripts\Patches"
|
||||||
|
mkdir "$(TargetDir)resources\Scripts\Update Existing Mechanics"
|
||||||
copy "$(TargetDir)Models\Code\*.txt" "$(TargetDir)resources"
|
copy "$(TargetDir)Models\Code\*.txt" "$(TargetDir)resources"
|
||||||
del "$(TargetDir)Models\Code\*.txt"
|
del "$(TargetDir)Models\Code\*.txt"
|
||||||
copy "$(TargetDir)Models\Code\*.toml" "$(TargetDir)resources"
|
copy "$(TargetDir)Models\Code\*.toml" "$(TargetDir)resources"
|
||||||
|
|
@ -64,6 +68,10 @@
|
||||||
copy "$(TargetDir)Models\Code\*.py" "$(TargetDir)resources"
|
copy "$(TargetDir)Models\Code\*.py" "$(TargetDir)resources"
|
||||||
del "$(TargetDir)Models\Code\*.py"
|
del "$(TargetDir)Models\Code\*.py"
|
||||||
copy "$(SolutionDir)src\HexManiac.WPF\Scripts\*.hma" "$(TargetDir)resources\Scripts"
|
copy "$(SolutionDir)src\HexManiac.WPF\Scripts\*.hma" "$(TargetDir)resources\Scripts"
|
||||||
|
copy "$(SolutionDir)src\HexManiac.WPF\Scripts\Add Mechanics From Later Generations\*.hma" "$(TargetDir)resources\Scripts\Add Mechanics From Later Generations"
|
||||||
|
copy "$(SolutionDir)src\HexManiac.WPF\Scripts\internal\*.hma" "$(TargetDir)resources\Scripts\internal"
|
||||||
|
copy "$(SolutionDir)src\HexManiac.WPF\Scripts\Patches\*.hma" "$(TargetDir)resources\Scripts\Patches"
|
||||||
|
copy "$(SolutionDir)src\HexManiac.WPF\Scripts\Update Existing Mechanics\*.hma" "$(TargetDir)resources\Scripts\Update Existing Mechanics"
|
||||||
</PostBuildEvent>
|
</PostBuildEvent>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -154,7 +154,7 @@ namespace HavenSoft.HexManiac.Tests {
|
||||||
if (tileset == null) continue;
|
if (tileset == null) continue;
|
||||||
var hasPalette = tileset.Format.Contains("|");
|
var hasPalette = tileset.Format.Contains("|");
|
||||||
if (!hasPalette) continue;
|
if (!hasPalette) continue;
|
||||||
|
|
||||||
yield return new object[] { gameName, anchor.Name };
|
yield return new object[] { gameName, anchor.Name };
|
||||||
}
|
}
|
||||||
gameIndex++;
|
gameIndex++;
|
||||||
|
|
@ -647,7 +647,7 @@ namespace HavenSoft.HexManiac.Tests {
|
||||||
public void ExpandableTutorsWorks(string game) {
|
public void ExpandableTutorsWorks(string game) {
|
||||||
var fileSystem = new StubFileSystem();
|
var fileSystem = new StubFileSystem();
|
||||||
var model = fixture.LoadModelNoCache(game);
|
var model = fixture.LoadModelNoCache(game);
|
||||||
var editor = new New(fileSystem,fixture.Singletons).EditorViewModel();
|
var editor = new New(fileSystem, fixture.Singletons).EditorViewModel();
|
||||||
var viewPort = NewViewPort(game, model);
|
var viewPort = NewViewPort(game, model);
|
||||||
editor.Add(viewPort);
|
editor.Add(viewPort);
|
||||||
var expandTutors = editor.QuickEditsExpansion.Single(edit => edit.Name == new MakeTutorsExpandable().Name);
|
var expandTutors = editor.QuickEditsExpansion.Single(edit => edit.Name == new MakeTutorsExpandable().Name);
|
||||||
|
|
@ -838,7 +838,7 @@ namespace HavenSoft.HexManiac.Tests {
|
||||||
var errors = new List<string>();
|
var errors = new List<string>();
|
||||||
viewport.OnError += (sender, e) => errors.Add(e);
|
viewport.OnError += (sender, e) => errors.Add(e);
|
||||||
|
|
||||||
var fairyTypeScript = File.ReadAllBytes("resources/Scripts/AddFairyType.hma");
|
var fairyTypeScript = File.ReadAllBytes("resources/Scripts/Add Mechanics From Later Generations/AnyGame_FairyType.hma");
|
||||||
viewport.TryImport(new("fairy.hma", fairyTypeScript), default);
|
viewport.TryImport(new("fairy.hma", fairyTypeScript), default);
|
||||||
|
|
||||||
Assert.Empty(errors);
|
Assert.Empty(errors);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user